From a82120eb51974c2f4a8d4eaa20a07bbdf3a61359 Mon Sep 17 00:00:00 2001 From: Rob Watson Date: Wed, 28 Apr 2021 09:57:20 +0200 Subject: [PATCH] updatevimplugin: add option to install to opt/ --- script/installvimplugin | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) 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