From 59aac3e28a99d5413b5c0a7228d2bb93e78d5f1d Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Thu, 25 Apr 2024 09:46:52 +0900 Subject: [PATCH] Add dpp#check_clean() --- autoload/dpp.vim | 4 ++++ autoload/dpp/util.vim | 11 +++++++++++ doc/dpp.txt | 21 +++++++++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/autoload/dpp.vim b/autoload/dpp.vim index 4e6ffb8..9c91ae9 100644 --- a/autoload/dpp.vim +++ b/autoload/dpp.vim @@ -76,3 +76,7 @@ function dpp#check_files( \ ) abort return dpp#util#_check_files(a:name) endfunction + +function dpp#check_clean() abort + return dpp#util#_check_clean() +endfunction diff --git a/autoload/dpp/util.vim b/autoload/dpp/util.vim index 51b3c73..40d760b 100644 --- a/autoload/dpp/util.vim +++ b/autoload/dpp/util.vim @@ -258,3 +258,14 @@ function dpp#util#_dos2unix(path) abort \ a:path \ ) endfunction + +function! dpp#util#_check_clean() abort + const plugins_directories = dpp#get()->values() + \ ->map({ _, val -> val.path }) + const path = dpp#util#_substitute_path( + \ 'repos/*/*/*'->globpath(g:dpp#_base_path, v:true)) + return path->split("\n")->filter( { _, val -> + \ val->isdirectory() && val->fnamemodify(':t') !=# 'dpp.vim' + \ && plugins_directories->index(val) < 0 + \ }) +endfunction diff --git a/doc/dpp.txt b/doc/dpp.txt index 3c08154..80d2586 100644 --- a/doc/dpp.txt +++ b/doc/dpp.txt @@ -130,6 +130,12 @@ dpp#async_ext_action({ext-name}, {action-name}[, {action-params}]) NOTE: It must be executed after |dpp#min#load_state()|. NOTE: It must be called after |DenopsReady|. + *dpp#check_clean()* +dpp#check_clean() + Returns the non-used plugins directories from dpp base path. + You can write the wrap command to remove them. + NOTE: It must be executed after |dpp#min#load_state()|. + *dpp#check_files()* dpp#check_files([{name}]) Check dpp.vim cache file is outdated. @@ -560,6 +566,10 @@ LUA FUNCTIONS *dpp-lua-functions* dpp.async_ext_action({ext-name}, {action-name}[, {action-params}]) Same as |dpp#async_ext_action()|. + *dpp.check_clean()* +dpp.check_clean() + Same as |dpp#check_clean()|. + *dpp.check_files()* dpp.check_files([{name}]) Same as |dpp#check_files()|. @@ -814,6 +824,9 @@ FAQ 5: |dpp-faq-5| FAQ 6: |dpp-faq-6| |DenopsReady| is not executed when |dpp#min#load_state()| is failed. +FAQ 7: |dpp-faq-7| + How to remove the disabled plugins? + ------------------------------------------------------------------------------ *dpp-faq-1* Q: How to donate money to you? @@ -892,6 +905,14 @@ You need to execute "plugin/denops.vim" manually by |:runtime| command. runtime! plugin/denops.vim < + *dpp-faq-7* +Q: How to remove the disabled plugins? + +A: You can remove them like below. +> + call map(dpp#check_clean(), { _, val -> delete(val, 'rf') }) +< + ============================================================================== COMPATIBILITY *dpp-compatibility*