dotfiles/script/installvimplugin

34 lines
658 B
Plaintext
Raw Normal View History

2021-04-05 07:59:54 +00:00
#!/usr/bin/env bash
#
# Install a vim plugin from Git (into start directory for now)
# Use with `-o` argument to install permanently to opt/
2021-04-05 07:59:54 +00:00
set -e
if [ "$1" = "-o" ]; then
opt=1
destdir="$HOME/.vim/pack/git-plugins/opt"
giturl="$2"
else
opt=0
destdir="$HOME/.vim/pack/git-plugins/start"
giturl="$1"
fi
if [ -z "$giturl" ]; then
2021-04-05 07:59:54 +00:00
echo "Usage: installvimplugin <git url>"
exit 1
fi
mkdir -p "$destdir"
basename=$(basename "$giturl" .git)
cd "$destdir"
2021-05-03 08:25:10 +00:00
git clone "$giturl" "$basename"
echo "Installed to $destdir/$basename"
if [ $opt = 1 ]; then
echo "Add the following line to $HOME/.vimrc:"
echo "packadd! $basename \" $giturl"
fi