From 9e7af4fefe25d4b16b894e42406886f97705e9a9 Mon Sep 17 00:00:00 2001 From: Tucker Evans Date: Thu, 18 Jan 2018 02:10:38 -0500 Subject: Created scripts to automate vim plugins management All scripts commit the changes. --- PlugInstall.sh | 36 ++++++++++++++++++++++++++++++++++++ PlugRemove.sh | 35 +++++++++++++++++++++++++++++++++++ PlugUpdate.sh | 18 ++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100755 PlugInstall.sh create mode 100755 PlugRemove.sh create mode 100755 PlugUpdate.sh 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" -- cgit v1.1