commit
c88ab60007
3 changed files with 20 additions and 3 deletions
|
@ -113,6 +113,7 @@ Reload .vimrc and `:PlugInstall` to install plugins.
|
|||
| `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 |
|
||||
|
|
6
plug.vim
6
plug.vim
|
@ -450,9 +450,9 @@ function! s:add(repo, ...)
|
|||
|
||||
try
|
||||
let repo = s:trim(a:repo)
|
||||
let name = fnamemodify(repo, ':t:s?\.git$??')
|
||||
let spec = extend(s:infer_properties(name, repo),
|
||||
\ a:0 == 1 ? s:parse_options(a:1) : s:base_spec)
|
||||
let opts = a:0 == 1 ? s:parse_options(a:1) : s:base_spec
|
||||
let name = get(opts, 'as', fnamemodify(repo, ':t:s?\.git$??'))
|
||||
let spec = extend(s:infer_properties(name, repo), opts)
|
||||
if !has_key(g:plugs, name)
|
||||
call add(g:plugs_order, name)
|
||||
endif
|
||||
|
|
|
@ -1341,3 +1341,19 @@ Execute (Commit hash support - cleared):
|
|||
let hash = system(printf('cd %s && git rev-parse HEAD', g:plugs['vim-emoji'].dir))[:-2]
|
||||
AssertNotEqual '9db7fcfee0d90dafdbcb7a32090c0a9085eb054a', hash
|
||||
q
|
||||
|
||||
Execute (#371 - 'as' option):
|
||||
call plug#begin()
|
||||
Plug 'jg/goyo.vim'
|
||||
Plug 'junegunn/goyo.vim', {'as': 'yogo'}
|
||||
call plug#end()
|
||||
AssertEqual ['goyo.vim', 'yogo'], sort(keys(g:plugs))
|
||||
Log g:plugs
|
||||
Assert g:plugs.yogo.dir =~# '/yogo/$'
|
||||
|
||||
call plug#begin()
|
||||
Plug 'junegunn/goyo.vim', {'as': 'yogo', 'dir': '/tmp/gogo'}
|
||||
call plug#end()
|
||||
AssertEqual ['yogo'], sort(keys(g:plugs))
|
||||
AssertEqual '/tmp/gogo/', g:plugs.yogo.dir
|
||||
|
||||
|
|
Loading…
Reference in a new issue