dotfiles/script/installvimplugins

29 lines
858 B
Bash
Executable File

#!/usr/bin/env bash
#
# Install vim plugins to $HOME/.vim/pack/git-plugins/opt
set -e
# Special case for fzf.vim plugin file:
# Note: not currently updated automatically by `updatevimplugins`
url="https://raw.githubusercontent.com/junegunn/fzf/master/plugin/fzf.vim"
echo "Fetching $url..."
mkdir -p $HOME/.vim/plugin
curl -sL -o $HOME/.vim/plugin/fzf.vim https://raw.githubusercontent.com/junegunn/fzf/master/plugin/fzf.vim
# 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
mkdir -p $pluginhome
cd $pluginhome
grep packadd! $HOME/.vimrc | grep -oP 'https.*$' | while read -r url ; do
dirname=$(basename $url .git)
if [ -d "$dirname" ]; then
echo "Exists: $dirname"
else
echo "Cloning $url.."
git clone --quiet --depth=1 "$url"
fi
done