diff options
author | Tucker Evans <tuckerevans24@gmail.com> | 2018-01-18 02:10:38 -0500 |
---|---|---|
committer | Tucker Evans <tuckerevans24@gmail.com> | 2018-01-18 02:10:38 -0500 |
commit | 9e7af4fefe25d4b16b894e42406886f97705e9a9 (patch) | |
tree | 9057dc36abe7eabc9b5fd801fa57e8e636b8d46f | |
parent | 1aed5e2d67d7a54afdd667899e964b86c5dc5013 (diff) |
Created scripts to automate vim plugins management
All scripts commit the changes.
-rwxr-xr-x | PlugInstall.sh | 36 | ||||
-rwxr-xr-x | PlugRemove.sh | 35 | ||||
-rwxr-xr-x | PlugUpdate.sh | 18 |
3 files changed, 89 insertions, 0 deletions
diff --git a/PlugInstall.sh b/PlugInstall.sh new file mode 100755 index 0000000..7d1c9d2 --- /dev/null +++ b/PlugInstall.sh @@ -0,0 +1,36 @@ +#!/bin/bash +if [ "$PWD" != "$HOME/dotfiles" ] +then + echo "Must be run in $HOME/dotfiles" + exit 1 +fi + + +PLUG_PATH="vim/.vim/pack/$USER/start/" +ARGS=0 +while getopts o opt; do + ((ARGS++)) + + if [ "$opt" == "o" ] + then + PLUG_PATH="vim/.vim/pack/$USER/opt/" + fi + if [ "$opt" == "h" ] + then + nroff .PlugHelp.tr + exit 0 + fi +done +((ARGS++)) +LINK="${!ARGS}" +PLUG_NAME=${LINK##*/} +FILENAME=${FILENAME%.git} +FILENAME="$PLUG_PATH$FILENAME" + +echo "Installing \"$PLUG_NAME\" into directory $PLUG_PATH" + + + +git submodule add $LINK $FILENAME && \ +git add .gitmodules $FILENAME && \ +git commit -m"Added vim plugin: $PLUG_NAME." && echo "Success" diff --git a/PlugRemove.sh b/PlugRemove.sh new file mode 100755 index 0000000..e8e0343 --- /dev/null +++ b/PlugRemove.sh @@ -0,0 +1,35 @@ +#!/bin/bash +#!/bin/bash +if [ "$PWD" != "$HOME/dotfiles" ] +then + echo "Must be run in $HOME/dotfiles" + exit 1 +fi + + +PLUG_PATH="vim/.vim/pack/$USER/start/" +ARGS=0 +while getopts o opt; do + ((ARGS++)) + + if [ "$opt" == "o" ] + then + PLUG_PATH="vim/.vim/pack/$USER/opt/" + fi + if [ "$opt" == "h" ] + then + nroff .PlugHelp.tr + exit 0 + fi +done +((ARGS++)) +NAME="${!ARGS}" +FILENAME="$PLUG_PATH$NAME" + +git submodule deinit -f $FILENAME +echo +git rm -f $FILENAME +echo +rm -rfv ".git/modules/$FILENAME" + +git commit -m"Removed vim plugin: $NAME" diff --git a/PlugUpdate.sh b/PlugUpdate.sh new file mode 100755 index 0000000..165219a --- /dev/null +++ b/PlugUpdate.sh @@ -0,0 +1,18 @@ +#!/bin/bash +if [ "$PWD" != "$HOME/dotfiles" ] +then + echo "Must be run in $HOME/dotfiles" + exit 1 +fi + + +while getopts o opt; do + if [ "$opt" == "h" ] + then + nroff .PlugHelp.tr + exit 0 + fi +done + +git submodule update --remote --merge && \ +git commit -m"Updated vim plugins." && echo "Success" |