fix: handle existing nvim config dir

This commit is contained in:
sailor 2026-06-03 23:18:21 +01:00
parent 3d5de5c64d
commit d757869b6f

View file

@ -1,3 +1,20 @@
#!/bin/sh #!/bin/sh
# Installs the Neovim config only; Neovim itself must already be installed. # Installs the Neovim config only; Neovim itself must already be installed.
mkdir -p "${XDG_CONFIG_HOME:-$HOME/.config}" && git clone https://git.sailorpunisher.com/sailor/nvim-config.git "${XDG_CONFIG_HOME:-$HOME/.config}/nvim" set -eu
repo_url='https://git.sailorpunisher.com/sailor/nvim-config.git'
target="${XDG_CONFIG_HOME:-$HOME/.config}/nvim"
mkdir -p "${XDG_CONFIG_HOME:-$HOME/.config}"
if [ -d "$target/.git" ]; then
git -C "$target" pull --ff-only
exit 0
fi
if [ -e "$target" ]; then
backup="${target}.bak-$(date +%Y%m%d-%H%M%S)"
mv "$target" "$backup"
fi
git clone "$repo_url" "$target"