From b44a5c3b215239fdb5d53e5c7268ecf3271541e2 Mon Sep 17 00:00:00 2001 From: Rob Watson Date: Mon, 5 Apr 2021 16:42:42 +0200 Subject: [PATCH] Update vim plugin management scripts --- script/cleanvimplugins | 12 +++++++++--- script/installvimplugin | 4 +++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/script/cleanvimplugins b/script/cleanvimplugins index 8c55fee..9000801 100755 --- a/script/cleanvimplugins +++ b/script/cleanvimplugins @@ -1,17 +1,23 @@ #!/usr/bin/env bash # # Check vim plugins dir for unused plugins +# Pass -a to also clean all plugins from start/ folder. +# # Note: does not perform deletion at this time, pipe output to bash. set -e -pluginhome=$HOME/.vim/pack/git-plugins/opt -cd $pluginhome +pluginhome=$HOME/.vim/pack/git-plugins +cd $pluginhome/opt find . -mindepth 1 -maxdepth 1 -type d -print0 | while read -d $'\0' pluginpath do if ! grep -q "$pluginpath" $HOME/.vimrc ; then basename=$(basename $pluginpath) - echo "rm -rf $pluginhome/$basename" + echo "rm -rf $pluginhome/opt/$basename" fi done + +if [ "$1" = "-a" ]; then + echo "rm -rf $pluginhome/start/*" +fi diff --git a/script/installvimplugin b/script/installvimplugin index 6578cdf..18f718f 100755 --- a/script/installvimplugin +++ b/script/installvimplugin @@ -10,5 +10,7 @@ if [ -z "$1" ]; then fi basename=$(basename "$1" .git) -cd "$HOME/.vim/pack/git-plugins/start" +dirname="$HOME/.vim/pack/git-plugins/start" +mkdir -p "$dirname" +cd "$dirname" git clone https://github.com/dense-analysis/ale.git "$basename"