dotfiles/script/cleanvimplugins

24 lines
570 B
Plaintext
Raw Normal View History

2021-04-03 08:51:47 +00:00
#!/usr/bin/env bash
2021-04-02 04:28:00 +00:00
#
# Check vim plugins dir for unused plugins
2021-04-05 14:42:42 +00:00
# Pass -a to also clean all plugins from start/ folder.
#
2021-04-02 04:28:00 +00:00
# Note: does not perform deletion at this time, pipe output to bash.
set -e
2021-04-05 14:42:42 +00:00
pluginhome=$HOME/.vim/pack/git-plugins
2021-04-02 04:28:00 +00:00
2023-10-07 08:43:32 +00:00
cd "$pluginhome/opt"
find . -mindepth 1 -maxdepth 1 -type d -print0 | while read -rd $'\0' pluginpath
2021-04-02 04:28:00 +00:00
do
2023-10-07 08:43:32 +00:00
if ! grep -q "$pluginpath" "$HOME/.config/nvim/init.vim" ; then
basename=$(basename "$pluginpath")
2021-04-05 14:42:42 +00:00
echo "rm -rf $pluginhome/opt/$basename"
2021-04-02 04:28:00 +00:00
fi
done
2021-04-05 14:42:42 +00:00
if [ "$1" = "-a" ]; then
echo "rm -rf $pluginhome/start/*"
fi