From a16c8525ef92c724bd0848cddcc48baa28dae26f Mon Sep 17 00:00:00 2001 From: Anthony Perkins Date: Mon, 3 Jun 2019 15:53:53 +0100 Subject: [PATCH] Update vim-pathogen to v2.4 --- pack/acp/opt/vim-pathogen/README.markdown | 2 +- .../opt/vim-pathogen/autoload/pathogen.vim | 74 +++++++++++++++++-- 2 files changed, 69 insertions(+), 7 deletions(-) diff --git a/pack/acp/opt/vim-pathogen/README.markdown b/pack/acp/opt/vim-pathogen/README.markdown index ce1f77a..00c2878 100644 --- a/pack/acp/opt/vim-pathogen/README.markdown +++ b/pack/acp/opt/vim-pathogen/README.markdown @@ -31,7 +31,7 @@ under `~/.vim/bundle`, and they will be added to the `'runtimepath'`. Observe: cd ~/.vim/bundle && \ - git clone https://github.com/tpope/vim-sensible.git + git clone git://github.com/tpope/vim-sensible.git Now [sensible.vim](https://github.com/tpope/vim-sensible) is installed. If you really want to get crazy, you could set it up as a submodule in diff --git a/pack/acp/opt/vim-pathogen/autoload/pathogen.vim b/pack/acp/opt/vim-pathogen/autoload/pathogen.vim index dbe07f0..e78d5a1 100644 --- a/pack/acp/opt/vim-pathogen/autoload/pathogen.vim +++ b/pack/acp/opt/vim-pathogen/autoload/pathogen.vim @@ -97,12 +97,10 @@ function! pathogen#is_disabled(path) abort return 1 endif let sep = pathogen#slash() - let blacklist = + let blacklist = map( \ get(g:, 'pathogen_blacklist', get(g:, 'pathogen_disabled', [])) + - \ pathogen#split($VIMBLACKLIST) - if !empty(blacklist) - call map(blacklist, 'substitute(v:val, "[\\/]$", "", "")') - endif + \ pathogen#split($VIMBLACKLIST), + \ 'substitute(v:val, "[\\/]$", "", "")') return index(blacklist, fnamemodify(a:path, ':t')) != -1 || index(blacklist, a:path) != -1 endfunction @@ -111,7 +109,7 @@ endfunction function! pathogen#surround(path) abort let sep = pathogen#slash() let rtp = pathogen#split(&rtp) - let path = fnamemodify(a:path, ':s?[\\/]\=$??') + let path = fnamemodify(a:path, ':p: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])') call filter(rtp, 'index(before + after, v:val) == -1') @@ -286,4 +284,68 @@ function! pathogen#runtime_append_all_bundles(...) abort return pathogen#interpose(a:0 ? a:1 . '/{}' : 'bundle/{}') endfunction +if exists(':Vedit') + finish +endif + +let s:vopen_warning = 0 + +function! s:find(count,cmd,file,lcd) + let rtp = pathogen#join(1,pathogen#split(&runtimepath)) + let file = pathogen#runtime_findfile(a:file,a:count) + if file ==# '' + return "echoerr 'E345: Can''t find file \"".a:file."\" in runtimepath'" + endif + if !s:vopen_warning + let s:vopen_warning = 1 + let warning = '|echohl WarningMsg|echo "Install scriptease.vim to continue using :V'.a:cmd.'"|echohl NONE' + else + let warning = '' + endif + if a:lcd + let path = file[0:-strlen(a:file)-2] + execute 'lcd `=path`' + return a:cmd.' '.pathogen#fnameescape(a:file) . warning + else + return a:cmd.' '.pathogen#fnameescape(file) . warning + endif +endfunction + +function! s:Findcomplete(A,L,P) + let sep = pathogen#slash() + let cheats = { + \'a': 'autoload', + \'d': 'doc', + \'f': 'ftplugin', + \'i': 'indent', + \'p': 'plugin', + \'s': 'syntax'} + if a:A =~# '^\w[\\/]' && has_key(cheats,a:A[0]) + let request = cheats[a:A[0]].a:A[1:-1] + else + let request = a:A + endif + let pattern = substitute(request,'/\|\'.sep,'*'.sep,'g').'*' + let found = {} + for path in pathogen#split(&runtimepath) + let path = expand(path, ':p') + let matches = split(glob(path.sep.pattern),"\n") + call map(matches,'isdirectory(v:val) ? v:val.sep : v:val') + call map(matches,'expand(v:val, ":p")[strlen(path)+1:-1]') + for match in matches + let found[match] = 1 + endfor + endfor + return sort(keys(found)) +endfunction + +command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Ve :execute s:find(,'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'\:'=':