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
|
|
|
|
2021-04-05 14:42:42 +00:00
|
|
|
cd $pluginhome/opt
|
2021-04-02 04:28:00 +00:00
|
|
|
find . -mindepth 1 -maxdepth 1 -type d -print0 | while read -d $'\0' pluginpath
|
|
|
|
do
|
2021-07-21 09:12:56 +00:00
|
|
|
if ! grep -q "$pluginpath" $HOME/.config/nvim/init.vim ; then
|
2021-04-02 04:28:00 +00:00
|
|
|
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
|