Skip to content

Commit

Permalink
Add dpp#check_clean()
Browse files Browse the repository at this point in the history
  • Loading branch information
Shougo committed Apr 25, 2024
1 parent 4516d30 commit 59aac3e
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
4 changes: 4 additions & 0 deletions autoload/dpp.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 11 additions & 0 deletions autoload/dpp/util.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
21 changes: 21 additions & 0 deletions doc/dpp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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()|.
Expand Down Expand Up @@ -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?
Expand Down Expand Up @@ -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*

Expand Down

0 comments on commit 59aac3e

Please sign in to comment.