dotfiles/script/installvimplugins

29 lines
884 B
Plaintext
Raw Normal View History

2021-04-03 08:51:47 +00:00
#!/usr/bin/env bash
2021-03-31 10:47:59 +00:00
#
# Install vim plugins to $HOME/.vim/pack/git-plugins/opt
2021-03-31 09:53:33 +00:00
set -e
# Special case for fzf.vim plugin file:
2021-04-02 04:07:11 +00:00
# Note: not currently updated automatically by `updatevimplugins`
2021-03-31 09:53:33 +00:00
url="https://raw.githubusercontent.com/junegunn/fzf/master/plugin/fzf.vim"
echo "Fetching $url..."
2023-10-07 08:43:32 +00:00
mkdir -p "$HOME/.vim/plugin"
curl -sL -o "$HOME/.vim/plugin/fzf.vim" https://raw.githubusercontent.com/junegunn/fzf/master/plugin/fzf.vim
2021-03-31 09:53:33 +00:00
# Relies on vimrc containing lines e.g.:
# packadd! rust.vim " https://github.com/rust-lang/rust.vim.git
pluginhome=$HOME/.vim/pack/git-plugins/opt
2023-10-07 08:43:32 +00:00
mkdir -p "$pluginhome"
cd "$pluginhome"
2021-03-31 09:53:33 +00:00
2023-10-07 08:43:32 +00:00
grep packadd! "$HOME/.config/nvim/init.vim" | grep -o 'https.*$' | while read -r url ; do
dirname=$(basename "$url" .git)
2021-04-02 04:07:11 +00:00
if [ -d "$dirname" ]; then
echo "Exists: $dirname"
else
echo "Cloning $url.."
git clone --quiet --depth=1 "$url"
fi
2021-03-31 09:53:33 +00:00
done