dotfiles/script/deletevimplugin

37 lines
611 B
Bash
Executable File

#!/usr/bin/env bash
#
# Delete a vim plugin.
# Use with `-o` argument to delete from opt/
set -e
if [ "$1" = "-o" ]; then
opt=1
dir="$HOME/.vim/pack/git-plugins/opt"
basename=$2
else
opt=0
dir="$HOME/.vim/pack/git-plugins/start"
basename=$1
fi
if [ -z "$basename" ]; then
echo "Usage: deletevimplugin [-o] <basename>"
exit 1
fi
path="$dir/$basename"
if [ ! -d "$path" ]; then
echo "Plugin not found: $basename"
exit 1
fi
rm -rf $path
echo "Deleted $basename"
if [ $opt = 1 ]; then
echo "Now, remove the following line to $HOME/.vimrc:"
echo "packadd! $basename \" <git url>"
fi