Install frozen plugin if it's not found (#113)
This commit is contained in:
parent
0263370bd1
commit
bd2cb9d2de
|
@ -75,14 +75,14 @@ Reload .vimrc and `:PlugInstall` to install plugins.
|
||||||
### `Plug` options
|
### `Plug` options
|
||||||
|
|
||||||
| Option | Description |
|
| Option | Description |
|
||||||
| -------------- | -------------------------------------------------------------------- |
|
| -------------- | ------------------------------------------------ |
|
||||||
| `branch`/`tag` | Branch or tag of the repository to use |
|
| `branch`/`tag` | Branch or tag of the repository to use |
|
||||||
| `rtp` | Subdirectory that contains Vim plugin |
|
| `rtp` | Subdirectory that contains Vim plugin |
|
||||||
| `dir` | Custom directory for the plugin |
|
| `dir` | Custom directory for the plugin |
|
||||||
| `do` | Post-update hook (string or funcref) |
|
| `do` | Post-update hook (string or funcref) |
|
||||||
| `on` | On-demand loading: Commands or `<Plug>`-mappings |
|
| `on` | On-demand loading: Commands or `<Plug>`-mappings |
|
||||||
| `for` | On-demand loading: File types |
|
| `for` | On-demand loading: File types |
|
||||||
| `frozen` | Do not install/update plugin unless explicitly given as the argument |
|
| `frozen` | Do not update unless explicitly specified |
|
||||||
|
|
||||||
### Global options
|
### Global options
|
||||||
|
|
||||||
|
|
7
plug.vim
7
plug.vim
|
@ -613,6 +613,11 @@ function! s:do(pull, force, todo)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:finish(pull)
|
function! s:finish(pull)
|
||||||
|
let new_frozen = len(filter(keys(s:update.new), 'g:plugs[v:val].frozen'))
|
||||||
|
if new_frozen
|
||||||
|
let s = new_frozen > 1 ? 's' : ''
|
||||||
|
call append(3, printf('- Installed %d frozen plugin%s', new_frozen, s))
|
||||||
|
endif
|
||||||
call append(3, '- Finishing ... ')
|
call append(3, '- Finishing ... ')
|
||||||
redraw
|
redraw
|
||||||
call plug#helptags()
|
call plug#helptags()
|
||||||
|
@ -652,7 +657,7 @@ function! s:update_impl(pull, force, args) abort
|
||||||
\ remove(args, -1) : get(g:, 'plug_threads', 16)
|
\ remove(args, -1) : get(g:, 'plug_threads', 16)
|
||||||
|
|
||||||
let managed = filter(copy(g:plugs), 's:is_managed(v:key)')
|
let managed = filter(copy(g:plugs), 's:is_managed(v:key)')
|
||||||
let todo = empty(args) ? filter(managed, '!v:val.frozen') :
|
let todo = empty(args) ? filter(managed, '!v:val.frozen || !isdirectory(v:val.dir)') :
|
||||||
\ filter(managed, 'index(args, v:key) >= 0')
|
\ filter(managed, 'index(args, v:key) >= 0')
|
||||||
|
|
||||||
if empty(todo)
|
if empty(todo)
|
||||||
|
|
|
@ -517,12 +517,37 @@ Execute (Common parent):
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
~ Frozen plugins
|
~ Frozen plugins
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
|
- We've decided to install plugins that are frozen: see #113
|
||||||
|
Execute (Frozen plugin are not ~~installed nor~~ updated):
|
||||||
|
" Remove plugins
|
||||||
|
call plug#begin()
|
||||||
|
call plug#end()
|
||||||
|
PlugClean!
|
||||||
|
q
|
||||||
|
|
||||||
Execute (Frozen plugin are not installed nor updated):
|
" vim-easy-align is not found, so it will be installed even though it's frozen
|
||||||
call plug#begin()
|
call plug#begin()
|
||||||
Plug 'junegunn/vim-easy-align', { 'frozen': 1 }
|
Plug 'junegunn/vim-easy-align', { 'frozen': 1 }
|
||||||
call plug#end()
|
call plug#end()
|
||||||
|
PlugInstall
|
||||||
|
AssertEqual 1, len(filter(getline(1, '$'), 'v:val =~ "vim-easy-align"'))
|
||||||
|
q
|
||||||
|
|
||||||
|
" Remove plugins again
|
||||||
|
call plug#begin()
|
||||||
|
call plug#end()
|
||||||
|
PlugClean!
|
||||||
|
q
|
||||||
|
|
||||||
|
" PlugUpdate will do the same
|
||||||
|
call plug#begin()
|
||||||
|
Plug 'junegunn/vim-easy-align', { 'frozen': 1 }
|
||||||
|
call plug#end()
|
||||||
|
PlugInstall
|
||||||
|
AssertEqual 1, len(filter(getline(1, '$'), 'v:val =~ "vim-easy-align"'))
|
||||||
|
q
|
||||||
|
|
||||||
|
" Since vim-easy-align already exists, PlugInstall or PlugUpdate will skip it
|
||||||
redir => out
|
redir => out
|
||||||
silent PlugInstall
|
silent PlugInstall
|
||||||
redir END
|
redir END
|
||||||
|
|
Loading…
Reference in New Issue
Block a user