From 7e112c8bfbb024ee37930370558ab6664cb474c8 Mon Sep 17 00:00:00 2001 From: Rob Watson Date: Mon, 18 Sep 2023 07:58:09 +0200 Subject: [PATCH] feat: add deletevimplugin script --- script/deletevimplugin | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 script/deletevimplugin diff --git a/script/deletevimplugin b/script/deletevimplugin new file mode 100755 index 0000000..b337f16 --- /dev/null +++ b/script/deletevimplugin @@ -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] " + 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 \" " +fi