diff --git a/script/installvimplugin b/script/installvimplugin index 18f718f..e3589c7 100755 --- a/script/installvimplugin +++ b/script/installvimplugin @@ -1,16 +1,33 @@ #!/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 [ -z "$1" ]; then +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 " exit 1 fi -basename=$(basename "$1" .git) -dirname="$HOME/.vim/pack/git-plugins/start" -mkdir -p "$dirname" -cd "$dirname" +mkdir -p "$destdir" +basename=$(basename "$giturl" .git) +cd "$destdir" git clone https://github.com/dense-analysis/ale.git "$basename" + +echo "Installed to $destdir/$basename" + +if [ $opt = 1 ]; then + echo "Add the following line to $HOME/.vimrc:" + echo "packadd! $basename \" $giturl" +fi