Skip to content

Commit f808500

Browse files
authored
Merge pull request #154 from TylerBarnes/fix/nvim-appname
fix: install/sync with NVIM_APPNAME
2 parents d3f2341 + f7c10d3 commit f808500

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

bin/nyoom

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,29 @@
33
set -o errexit -o pipefail -o nounset
44

55
# people like xdg
6-
CONFIG_PATH="${XDG_CONFIG_HOME:-${HOME}/.config}/${NVIM_APPNAME:-nvim}"
7-
CACHE_PATH="${XDG_CACHE_HOME:-${HOME}/.cache}/${NVIM_APPNAME:-nvim}"
8-
DATA_PATH="${XDG_DATA_HOME:-${HOME}/.local/share}/${NVIM_APPNAME:-nvim}"
6+
NVIM_APPNAME="${NVIM_APPNAME:-nvim}"
7+
CONFIG_PATH="${XDG_CONFIG_HOME:-${HOME}/.config}/${NVIM_APPNAME}"
8+
CACHE_PATH="${XDG_CACHE_HOME:-${HOME}/.cache}/${NVIM_APPNAME}"
9+
DATA_PATH="${XDG_DATA_HOME:-${HOME}/.local/share}/${NVIM_APPNAME}"
910
NYOOM_CONFIG="${XDG_DATA_HOME:-${HOME}/.config}/nyoom"
1011

12+
NYOOM_CURRENT_DIR_REAL=$(realpath "$(pwd)")
13+
NYOOM_BASENAME=$(basename "$NYOOM_CURRENT_DIR_REAL")
14+
15+
if [[ "$NYOOM_CURRENT_DIR_REAL" != "$CONFIG_PATH" ]]; then
16+
echo "The directory you're running bin/nyoom ${1:-} in is not the expected location.";
17+
echo
18+
read -p "Set NVIM_APPNAME=${NYOOM_BASENAME} before continuing? " -n 1 -r;
19+
if [[ $REPLY =~ ^[Yy]$ ]]; then
20+
NVIM_APPNAME=$NYOOM_BASENAME
21+
else
22+
echo "";
23+
echo "Please clone Nyoom to ~/.config/nvim or run this command as 'NVIM_APPNAME=${NYOOM_BASENAME} bin/nyoom ${1:-}'"
24+
exit;
25+
fi
26+
27+
fi
28+
1129
mkdir -p "$CONFIG_PATH" "$CACHE_PATH" "$DATA_PATH" "$NYOOM_CONFIG"
1230

1331
# silently enter ${CONFIG_PATH} when updating
@@ -77,7 +95,7 @@ sync)
7795
rm -f "${CONFIG_PATH}/lua/packer_compiled.lua" || true
7896
# set ulimit to fix packer.sync hanging with --headless: https://github.com/wbthomason/packer.nvim/issues/751
7997
ulimit -S -n 4096
80-
NYOOM_CLI=true nvim --headless -c 'autocmd User PackerComplete quitall' -c 'lua require("packer").sync()'
98+
NYOOM_CLI=true NVIM_APPNAME=$NVIM_APPNAME nvim --headless -c 'autocmd User PackerComplete quitall' -c 'lua require("packer").sync()'
8199
echo
82100
if [ -d "${DATA_PATH}/site/pack/packer/opt/nvim-treesitter/" ]; then
83101
echo

0 commit comments

Comments
 (0)