diff --git a/autoload/pathogen.vim b/autoload/pathogen.vim index a13ae08f..b2891cdd 100755 --- a/autoload/pathogen.vim +++ b/autoload/pathogen.vim @@ -1,6 +1,6 @@ " pathogen.vim - path option manipulation " Maintainer: Tim Pope -" Version: 2.3 +" Version: 2.4 " Install in ~/.vim/autoload (or ~\vimfiles\autoload). " @@ -16,22 +16,29 @@ endif let g:loaded_pathogen = 1 " Point of entry for basic default usage. Give a relative path to invoke -" pathogen#interpose() (defaults to "bundle/{}"), or an absolute path to invoke -" pathogen#surround(). Curly braces are expanded with pathogen#expand(): -" "bundle/{}" finds all subdirectories inside "bundle" inside all directories -" in the runtime path. +" pathogen#interpose() or an absolute path to invoke pathogen#surround(). +" Curly braces are expanded with pathogen#expand(): "bundle/{}" finds all +" subdirectories inside "bundle" inside all directories in the runtime path. +" If no arguments are given, defaults "bundle/{}", and also "pack/{}/start/{}" +" on versions of Vim without native package support. function! pathogen#infect(...) abort - for path in a:0 ? filter(reverse(copy(a:000)), 'type(v:val) == type("")') : ['bundle/{}'] - if path =~# '^\%({\=[$~\\/]\|{\=\w:[\\/]\).*[{}*]' + if a:0 + let paths = filter(reverse(copy(a:000)), 'type(v:val) == type("")') + else + let paths = ['bundle/{}', 'pack/{}/start/{}'] + endif + if has('packages') + call filter(paths, 'v:val !~# "^pack/[^/]*/start/[^/]*$"') + endif + let static = '^\%([$~\\/]\|\w:[\\/]\)[^{}*]*$' + for path in filter(copy(paths), 'v:val =~# static') + call pathogen#surround(path) + endfor + for path in filter(copy(paths), 'v:val !~# static') + if path =~# '^\%([$~\\/]\|\w:[\\/]\)' call pathogen#surround(path) - elseif path =~# '^\%([$~\\/]\|\w:[\\/]\)' - call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')') - call pathogen#surround(path . '/{}') - elseif path =~# '[{}*]' - call pathogen#interpose(path) else - call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')') - call pathogen#interpose(path . '/{}') + call pathogen#interpose(path) endif endfor call pathogen#cycle_filetype() @@ -90,27 +97,28 @@ function! pathogen#cycle_filetype() abort endfunction " Check if a bundle is disabled. A bundle is considered disabled if its -" basename or full name is included in the list g:pathogen_disabled. +" basename or full name is included in the list g:pathogen_blacklist or the +" comma delimited environment variable $VIMBLACKLIST. function! pathogen#is_disabled(path) abort if a:path =~# '\~$' return 1 endif let sep = pathogen#slash() - let blacklist = map( - \ get(g:, 'pathogen_blacklist', get(g:, 'pathogen_disabled', [])) + - \ pathogen#split($VIMBLACKLIST), - \ 'substitute(v:val, "[\\/]$", "", "")') + let blacklist = get(g:, 'pathogen_blacklist', get(g:, 'pathogen_disabled', [])) + pathogen#split($VIMBLACKLIST) + if !empty(blacklist) + call map(blacklist, 'substitute(v:val, "[\\/]$", "", "")') + endif return index(blacklist, fnamemodify(a:path, ':t')) != -1 || index(blacklist, a:path) != -1 -endfunction "}}}1 +endfunction " Prepend the given directory to the runtime path and append its corresponding " after directory. Curly braces are expanded with pathogen#expand(). function! pathogen#surround(path) abort let sep = pathogen#slash() let rtp = pathogen#split(&rtp) - let path = fnamemodify(a:path, ':p:?[\\/]\=$??') + let path = fnamemodify(a:path, ':s?[\\/]\=$??') let before = filter(pathogen#expand(path), '!pathogen#is_disabled(v:val)') - let after = filter(reverse(pathogen#expand(path.sep.'after')), '!pathogen#is_disabled(v:val[0:-7])') + let after = filter(reverse(pathogen#expand(path, sep.'after')), '!pathogen#is_disabled(v:val[0 : -7])') call filter(rtp, 'index(before + after, v:val) == -1') let &rtp = pathogen#join(before, rtp, after) return &rtp @@ -128,7 +136,7 @@ function! pathogen#interpose(name) abort let list = [] for dir in pathogen#split(&rtp) if dir =~# '\,'edit',,0) -command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vedit :execute s:find(,'edit',,0) -command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vopen :execute s:find(,'edit',,1) -command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vsplit :execute s:find(,'split',,1) -command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vvsplit :execute s:find(,'vsplit',,1) -command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vtabedit :execute s:find(,'tabedit',,1) -command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit :execute s:find(,'pedit',,1) -command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vread :execute s:find(,'read',,1) - " vim:set et sw=2 foldmethod=expr foldexpr=getline(v\:lnum)=~'^\"\ Section\:'?'>1'\:getline(v\:lnum)=~#'^fu'?'a1'\:getline(v\:lnum)=~#'^endf'?'s1'\:'=':