fix: handle existing nvim config dir
This commit is contained in:
parent
3d5de5c64d
commit
d757869b6f
1 changed files with 18 additions and 1 deletions
19
install.sh
19
install.sh
|
|
@ -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"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue