Fix #184 - Avoid duplicate entries in g:plugs_order

This commit is contained in:
Junegunn Choi 2015-02-25 22:31:39 +09:00
parent c759170ce2
commit a34b745a21
2 changed files with 17 additions and 1 deletions

View file

@ -427,8 +427,10 @@ function! s:add(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)
if !has_key(g:plugs, name)
call add(g:plugs_order, name)
endif
let g:plugs[name] = spec
let g:plugs_order += [name]
let s:loaded[name] = 0
catch
return s:err(v:exception)

View file

@ -226,3 +226,17 @@ Execute (#154: Spaces in &rtp should not be escaped):
Log &rtp
Assert stridx(&rtp, 'plug it/seoul256 vim') >= 0
**********************************************************************
Execute (#184: Duplicate entries in &rtp):
call plug#begin('$TMPDIR/plugged')
Plug 'plugin1'
\| Plug 'plugin0'
Plug 'plugin2'
\| Plug 'plugin0'
\| Plug 'plugin1'
call plug#end()
Log &rtp
AssertEqual 3, len(uniq(filter(split(&rtp, ','), 'stridx(v:val, "plugged") >= 0')))