updatevimplugin: add option to install to opt/

This commit is contained in:
Rob Watson 2021-04-28 09:57:20 +02:00
parent e82848fe9d
commit a82120eb51
1 changed files with 22 additions and 5 deletions

View File

@ -1,16 +1,33 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# #
# Install a vim plugin from Git (into start directory for now) # Install a vim plugin from Git (into start directory for now)
# Use with `-o` argument to install permanently to opt/
set -e 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 <git url>" echo "Usage: installvimplugin <git url>"
exit 1 exit 1
fi fi
basename=$(basename "$1" .git) mkdir -p "$destdir"
dirname="$HOME/.vim/pack/git-plugins/start" basename=$(basename "$giturl" .git)
mkdir -p "$dirname" cd "$destdir"
cd "$dirname"
git clone https://github.com/dense-analysis/ale.git "$basename" 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