34 lines
658 B
Bash
Executable File
34 lines
658 B
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Install a vim plugin from Git (into start directory for now)
|
|
# Use with `-o` argument to install permanently to opt/
|
|
|
|
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
|
|
echo "Usage: installvimplugin <git url>"
|
|
exit 1
|
|
fi
|
|
|
|
mkdir -p "$destdir"
|
|
basename=$(basename "$giturl" .git)
|
|
cd "$destdir"
|
|
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
|