Add dir
option: managed plugins outside g:plug_home
This commit is contained in:
parent
eeef77e9c8
commit
f58d090bb2
3 changed files with 27 additions and 2 deletions
|
@ -76,6 +76,7 @@ Reload .vimrc and `:PlugInstall` to install plugins.
|
||||||
| -------------- | -------------------------------------------------------------------- |
|
| -------------- | -------------------------------------------------------------------- |
|
||||||
| `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 |
|
||||||
| `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 |
|
||||||
|
|
7
plug.vim
7
plug.vim
|
@ -319,8 +319,8 @@ function! s:add(force, repo, ...)
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let spec = extend(a:0 == 1 ? s:parse_options(a:1) : copy(s:base_spec),
|
let spec = extend(s:infer_properties(name, repo),
|
||||||
\ s:infer_properties(name, repo))
|
\ a:0 == 1 ? s:parse_options(a:1) : copy(s:base_spec))
|
||||||
if !a:force
|
if !a:force
|
||||||
let s:extended[name] = spec
|
let s:extended[name] = spec
|
||||||
endif
|
endif
|
||||||
|
@ -342,6 +342,9 @@ function! s:parse_options(arg)
|
||||||
if has_key(opts, 'tag')
|
if has_key(opts, 'tag')
|
||||||
let opts.branch = remove(opts, 'tag')
|
let opts.branch = remove(opts, 'tag')
|
||||||
endif
|
endif
|
||||||
|
if has_key(opts, 'dir')
|
||||||
|
let opts.dir = s:dirpath(expand(opts.dir))
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
throw 'Invalid argument type (expected: string or dictionary)'
|
throw 'Invalid argument type (expected: string or dictionary)'
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -660,6 +660,27 @@ Execute (Using Funcref):
|
||||||
Assert filereadable(g:plugs['vim-pseudocl'].dir.'/vim-pseudoclinstalled2'),
|
Assert filereadable(g:plugs['vim-pseudocl'].dir.'/vim-pseudoclinstalled2'),
|
||||||
\ 'vim-pseudocl/vim-pseudoclinstalled2 should exist'
|
\ 'vim-pseudocl/vim-pseudoclinstalled2 should exist'
|
||||||
|
|
||||||
|
|
||||||
|
**********************************************************************
|
||||||
|
~ Overriding `dir`
|
||||||
|
**********************************************************************
|
||||||
|
|
||||||
|
Execute (Using custom dir):
|
||||||
|
Assert isdirectory(g:plugs['vim-easy-align'].dir)
|
||||||
|
|
||||||
|
call plug#begin()
|
||||||
|
Plug 'junegunn/vim-easy-align', { 'dir': $TMPDIR.'easy-align' }
|
||||||
|
call plug#end()
|
||||||
|
AssertEqual $TMPDIR.'easy-align/', g:plugs['vim-easy-align'].dir
|
||||||
|
|
||||||
|
PlugClean!
|
||||||
|
Assert !isdirectory(g:plugs['vim-easy-align'].dir)
|
||||||
|
q
|
||||||
|
|
||||||
|
PlugInstall
|
||||||
|
q
|
||||||
|
Assert isdirectory(g:plugs['vim-easy-align'].dir)
|
||||||
|
|
||||||
Execute (Cleanup):
|
Execute (Cleanup):
|
||||||
call system('rm -rf '.temp_plugged)
|
call system('rm -rf '.temp_plugged)
|
||||||
call rename('fzf', 'fzf-staged')
|
call rename('fzf', 'fzf-staged')
|
||||||
|
|
Loading…
Reference in a new issue