Scripts(nvim): Check nvim existence and optionally upgrade vim-plug

This commit is contained in:
hedy 2022-03-29 12:22:31 +08:00
parent 9bc6938e4a
commit 6c453aaccd
Signed by: hedy
GPG Key ID: B51B5A8D1B176372
1 changed files with 11 additions and 2 deletions

View File

@ -1,11 +1,20 @@
#!/usr/bin/env bash
if ! command -v nvim &> /dev/null; then
echo "ERROR: nvim not found"
fi
DEST=${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim"
if ! [[ -f "$DEST" ]]; then
echo "installing vim-plug for nvim"
sh -c 'curl -fLo "$DEST" --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
echo "installing nvim plugins"
nvim +PlugInstall
else
echo "upgrading vim-plug"
nvim +PlugUpgrade
echo "upgrading nvim plugins"
nvim +PlugUpdate
fi
echo "installing nvim plugins"
nvim +PlugInstall