diff --git a/plug.vim b/plug.vim index 52c3dc2..8886b2a 100644 --- a/plug.vim +++ b/plug.vim @@ -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) diff --git a/test/regressions.vader b/test/regressions.vader index 2280178..e6a70e8 100644 --- a/test/regressions.vader +++ b/test/regressions.vader @@ -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'))) +