fix install_nvchad.sh: stash around pull, use deploy_nvim from _lib.sh
The bare git pull was blocking sync when nvchad had local changes (e.g. a typechange from symlink), causing set -euo pipefail to abort the whole script before deploy_nvim ran. Stash/pop makes the pull safe. Replaces the local deploy_nvim_modules (which blindly backed up and recreated symlinks every run, accumulating .backup files) with deploy_nvim from _lib.sh, which is idempotent and shared with sync.sh. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
8432a87a1e
commit
83f95e1f3f
@ -5,20 +5,7 @@ REPO="git@gitea.hptrow.me:pt/nvchad.git"
|
||||
BRANCH="customize"
|
||||
NVIM_CONFIG="$HOME/.config/nvim"
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
|
||||
deploy_nvim_modules() {
|
||||
local src_dir="$SCRIPT_DIR/dotfiles/nvim"
|
||||
[[ -d "$src_dir" ]] || return 0
|
||||
[[ -d "$NVIM_CONFIG/lua" ]] || return 0
|
||||
echo "Deploying nvim lua modules..."
|
||||
for mod in "$src_dir"/*.lua; do
|
||||
[[ -f "$mod" ]] || continue
|
||||
local target="$NVIM_CONFIG/lua/$(basename "$mod")"
|
||||
[[ -e "$target" ]] && mv "$target" "${target}.backup"
|
||||
ln -s "$mod" "$target"
|
||||
echo " linked: $(basename "$mod")"
|
||||
done
|
||||
}
|
||||
source "$SCRIPT_DIR/_lib.sh"
|
||||
|
||||
echo "============================================"
|
||||
echo "NvChad Configuration Installation Script"
|
||||
@ -59,8 +46,10 @@ if [ -d "$NVIM_CONFIG/.git" ]; then
|
||||
EXISTING_REMOTE=$(git -C "$NVIM_CONFIG" remote get-url "$REMOTE_NAME" 2>/dev/null || echo "")
|
||||
if [ "$EXISTING_REMOTE" = "$REPO" ]; then
|
||||
echo "NvChad config already installed — pulling latest..."
|
||||
git -C "$NVIM_CONFIG" stash
|
||||
git -C "$NVIM_CONFIG" pull "$REMOTE_NAME" "$BRANCH"
|
||||
deploy_nvim_modules
|
||||
git -C "$NVIM_CONFIG" stash pop 2>/dev/null || true
|
||||
deploy_nvim
|
||||
echo "Done."
|
||||
exit 0
|
||||
fi
|
||||
@ -105,7 +94,7 @@ echo ""
|
||||
echo "Config cloned successfully!"
|
||||
echo ""
|
||||
|
||||
deploy_nvim_modules
|
||||
deploy_nvim
|
||||
|
||||
echo ""
|
||||
echo "============================================"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user