updatevimplugin: add option to install to opt/
This commit is contained in:
parent
e82848fe9d
commit
a82120eb51
|
@ -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 <git url>"
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue