feat: add deletevimplugin script

This commit is contained in:
Rob Watson 2023-09-18 07:58:09 +02:00
parent d26f2af5e5
commit 7e112c8bfb
1 changed files with 36 additions and 0 deletions

36
script/deletevimplugin Executable file
View File

@ -0,0 +1,36 @@
#!/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