diff --git a/autoload/pathogen.vim b/autoload/pathogen.vim index 7b89ccaf..d0ee0417 100644 --- a/autoload/pathogen.vim +++ b/autoload/pathogen.vim @@ -25,20 +25,17 @@ endfunction " Point of entry for basic default usage. Give a relative path to invoke " pathogen#incubate() (defaults to "bundle/{}"), or an absolute path to invoke " pathogen#surround(). For backwards compatibility purposes, a full path that -" does not end in {} or * is given to pathogen#runtime_prepend_subdirectories() -" instead. +" does not end in {} or * is given to pathogen#surround(). function! pathogen#infect(...) abort " {{{1 for path in a:0 ? reverse(copy(a:000)) : ['bundle/{}'] - if path =~# '^[^\\/]\+$' + if path !~# '[\\/]\%({}\|\*\)$' " Doesn't end with a mask '/{}' or '/*' call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')') - call pathogen#incubate(path . '/{}') - elseif path =~# '^[^\\/]\+[\\/]\%({}\|\*\)$' + let path = path . '/{}' + endif + if path =~# '^[^\\/~]' " Doesn't start from slash or tilde => relative call pathogen#incubate(path) - elseif path =~# '[\\/]\%({}\|\*\)$' - call pathogen#surround(path) else - call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')') - call pathogen#surround(path . '/{}') + call pathogen#surround(path) endif endfor call pathogen#cycle_filetype() @@ -159,14 +156,15 @@ function! pathogen#surround(path) abort " {{{1 call filter(rtp, 'index(before + after, v:val) == -1') endif let &rtp = pathogen#join(before, rtp, after) - return &rtp + return {'before' : before, 'after' : after} endfunction " }}}1 " Prepend all subdirectories of path to the rtp, and append all 'after' " directories in those subdirectories. Deprecated. function! pathogen#runtime_prepend_subdirectories(path) " {{{1 call s:warn('Change pathogen#runtime_prepend_subdirectories('.string(a:path).') to pathogen#surround('.string(a:path.'/{}').')') - return pathogen#surround(a:path . pathogen#separator() . '{}') + call pathogen#surround(a:path . pathogen#separator() . '{}') + return &rtp " for backwards compatibility with earlier pathogen#surround() impl endfunction " }}}1 " For each directory in the runtime path, add a second entry with the given @@ -182,24 +180,44 @@ function! pathogen#incubate(...) abort " {{{1 return "" endif let s:done_bundles .= name . "\n" - let list = [] + let rtp_list = [] " full list of old and newly added runtimepath entries + " newly added entries only + let before = [] + let after = [] + " newly added entries for current rtp dir + let before_dir = [] + let after_dir = [] + for dir in pathogen#split(&rtp) if dir =~# '\