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