Skip to content

Commit

Permalink
Merge pull request #387 from junegunn/as
Browse files Browse the repository at this point in the history
Add 'as' option
  • Loading branch information
junegunn committed Jan 25, 2016
2 parents 676174c + 7d494b4 commit c88ab60
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
6 changes: 3 additions & 3 deletions plug.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions test/workflow.vader
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit c88ab60

Please sign in to comment.