Skip to content

Commit

Permalink
Do not remove 'frozen' plugins on PlugClean
Browse files Browse the repository at this point in the history
Close #1152
  • Loading branch information
junegunn committed Mar 30, 2024
1 parent 24d7ac2 commit d977fa3
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 17 deletions.
22 changes: 11 additions & 11 deletions README.md
Expand Up @@ -234,24 +234,24 @@ More examples can be found in:
| ----------------------------------- | ------------------------------------------------------------------ |
| `PlugInstall [name ...] [#threads]` | Install plugins |
| `PlugUpdate [name ...] [#threads]` | Install or update plugins |
| `PlugClean[!]` | Remove unlisted plugins (bang version will clean without prompt) |
| `PlugClean[!]` | Remove unlisted plugins (bang version will clean without prompt) |
| `PlugUpgrade` | Upgrade vim-plug itself |
| `PlugStatus` | Check the status of plugins |
| `PlugDiff` | Examine changes from the previous update and the pending changes |
| `PlugSnapshot[!] [output path]` | Generate script for restoring the current snapshot of the plugins |

### `Plug` options

| Option | Description |
| ----------------------- | ------------------------------------------------ |
| `branch`/`tag`/`commit` | Branch/tag/commit of the repository to use |
| `rtp` | Subdirectory that contains Vim plugin |
| `dir` | Custom directory for the plugin |
| `as` | Use different name for the plugin |
| `do` | Post-update hook (string or funcref) |
| `on` | On-demand loading: Commands or `<Plug>`-mappings |
| `for` | On-demand loading: File types |
| `frozen` | Do not update unless explicitly specified |
| Option | Description |
| ----------------------- | ----------------------------------------------------------- |
| `branch`/`tag`/`commit` | Branch/tag/commit of the repository to use |
| `rtp` | Subdirectory that contains Vim plugin |
| `dir` | Custom directory for the plugin |
| `as` | Use different name for the plugin |
| `do` | Post-update hook (string or funcref) |
| `on` | On-demand loading: Commands or `<Plug>`-mappings |
| `for` | On-demand loading: File types |
| `frozen` | Do not remove and do not update unless explicitly specified |

### Global options

Expand Down
10 changes: 5 additions & 5 deletions doc/plug.txt
@@ -1,4 +1,4 @@
plug.txt plug Last change: March 14 2024
plug.txt plug Last change: March 31 2024
PLUG - TABLE OF CONTENTS *plug* *plug-toc*
==============================================================================

Expand Down Expand Up @@ -188,18 +188,18 @@ More examples can be found in:

*<Plug>-mappings*

------------------------+-----------------------------------------------
------------------------+------------------------------------------------------------
Option | Description ~
------------------------+-----------------------------------------------
------------------------+------------------------------------------------------------
`branch` / `tag` / `commit` | Branch/tag/commit of the repository to use
`rtp` | Subdirectory that contains Vim plugin
`dir` | Custom directory for the plugin
`as` | Use different name for the plugin
`do` | Post-update hook (string or funcref)
`on` | On-demand loading: Commands or <Plug>-mappings
`for` | On-demand loading: File types
`frozen` | Do not update unless explicitly specified
------------------------+-----------------------------------------------
`frozen` | Do not remove and do not update unless explicitly specified
------------------------+------------------------------------------------------------


< Global options >____________________________________________________________~
Expand Down
2 changes: 1 addition & 1 deletion plug.vim
Expand Up @@ -2435,7 +2435,7 @@ function! s:clean(force)
let errs = {}
let [cnt, total] = [0, len(g:plugs)]
for [name, spec] in items(g:plugs)
if !s:is_managed(name)
if !s:is_managed(name) || get(spec, 'frozen', 0)
call add(dirs, spec.dir)
else
let [err, clean] = s:git_validate(spec, 1)
Expand Down
8 changes: 8 additions & 0 deletions test/workflow.vader
Expand Up @@ -804,6 +804,14 @@ Execute (Check &rtp after SomeCommand):
AssertEqual g:first_rtp, split(&rtp, ',')[0]
AssertEqual g:last_rtp, split(&rtp, ',')[-1]

Execute (PlugClean should not care about frozen plugins):
call plug#begin()
Plug 'xxx/vim-easy-align', { 'frozen': 1 }
call plug#end()
PlugClean
AssertExpect 'Already clean', 1
q

Execute (Common parent):
call plug#begin()
Plug 'junegunn/vim-pseudocl'
Expand Down

0 comments on commit d977fa3

Please sign in to comment.