mirror of
https://github.com/notwa/rc
synced 2024-11-05 04:39:03 -08:00
update pathogen
This commit is contained in:
parent
b9d677b033
commit
004cc98b51
1 changed files with 28 additions and 53 deletions
|
@ -16,22 +16,29 @@ endif
|
||||||
let g:loaded_pathogen = 1
|
let g:loaded_pathogen = 1
|
||||||
|
|
||||||
" Point of entry for basic default usage. Give a relative path to invoke
|
" 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#interpose() or an absolute path to invoke pathogen#surround().
|
||||||
" pathogen#surround(). Curly braces are expanded with pathogen#expand():
|
" Curly braces are expanded with pathogen#expand(): "bundle/{}" finds all
|
||||||
" "bundle/{}" finds all subdirectories inside "bundle" inside all directories
|
" subdirectories inside "bundle" inside all directories in the runtime path.
|
||||||
" 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
|
function! pathogen#infect(...) abort
|
||||||
for path in a:0 ? filter(reverse(copy(a:000)), 'type(v:val) == type("")') : ['bundle/{}']
|
if a:0
|
||||||
if path =~# '^\%({\=[$~\\/]\|{\=\w:[\\/]\).*[{}*]'
|
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)
|
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
|
else
|
||||||
call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')')
|
call pathogen#interpose(path)
|
||||||
call pathogen#interpose(path . '/{}')
|
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
call pathogen#cycle_filetype()
|
call pathogen#cycle_filetype()
|
||||||
|
@ -97,9 +104,7 @@ function! pathogen#is_disabled(path) abort
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
let sep = pathogen#slash()
|
let sep = pathogen#slash()
|
||||||
let blacklist =
|
let blacklist = get(g:, 'pathogen_blacklist', get(g:, 'pathogen_disabled', [])) + pathogen#split($VIMBLACKLIST)
|
||||||
\ get(g:, 'pathogen_blacklist', get(g:, 'pathogen_disabled', [])) +
|
|
||||||
\ pathogen#split($VIMBLACKLIST)
|
|
||||||
if !empty(blacklist)
|
if !empty(blacklist)
|
||||||
call map(blacklist, 'substitute(v:val, "[\\/]$", "", "")')
|
call map(blacklist, 'substitute(v:val, "[\\/]$", "", "")')
|
||||||
endif
|
endif
|
||||||
|
@ -176,19 +181,20 @@ endfunction
|
||||||
" and globbed. Actual globs are preserved.
|
" and globbed. Actual globs are preserved.
|
||||||
function! pathogen#expand(pattern, ...) abort
|
function! pathogen#expand(pattern, ...) abort
|
||||||
let after = a:0 ? a:1 : ''
|
let after = a:0 ? a:1 : ''
|
||||||
if a:pattern =~# '{[^{}]\+}'
|
let pattern = substitute(a:pattern, '^[~$][^\/]*', '\=expand(submatch(0))', '')
|
||||||
let [pre, pat, post] = split(substitute(a:pattern, '\(.\{-\}\){\([^{}]\+\)}\(.*\)', "\\1\001\\2\001\\3", ''), "\001", 1)
|
if pattern =~# '{[^{}]\+}'
|
||||||
|
let [pre, pat, post] = split(substitute(pattern, '\(.\{-\}\){\([^{}]\+\)}\(.*\)', "\\1\001\\2\001\\3", ''), "\001", 1)
|
||||||
let found = map(split(pat, ',', 1), 'pre.v:val.post')
|
let found = map(split(pat, ',', 1), 'pre.v:val.post')
|
||||||
let results = []
|
let results = []
|
||||||
for pattern in found
|
for pattern in found
|
||||||
call extend(results, pathogen#expand(pattern))
|
call extend(results, pathogen#expand(pattern))
|
||||||
endfor
|
endfor
|
||||||
elseif a:pattern =~# '{}'
|
elseif pattern =~# '{}'
|
||||||
let pat = matchstr(a:pattern, '^.*{}[^*]*\%($\|[\\/]\)')
|
let pat = matchstr(pattern, '^.*{}[^*]*\%($\|[\\/]\)')
|
||||||
let post = a:pattern[strlen(pat) : -1]
|
let post = pattern[strlen(pat) : -1]
|
||||||
let results = map(split(glob(substitute(pat, '{}', '*', 'g')), "\n"), 'v:val.post')
|
let results = map(split(glob(substitute(pat, '{}', '*', 'g')), "\n"), 'v:val.post')
|
||||||
else
|
else
|
||||||
let results = [a:pattern]
|
let results = [pattern]
|
||||||
endif
|
endif
|
||||||
let vf = pathogen#slash() . 'vimfiles'
|
let vf = pathogen#slash() . 'vimfiles'
|
||||||
call map(results, 'v:val =~# "\\*" ? v:val.after : isdirectory(v:val.vf.after) ? v:val.vf.after : isdirectory(v:val.after) ? v:val.after : ""')
|
call map(results, 'v:val =~# "\\*" ? v:val.after : isdirectory(v:val.vf.after) ? v:val.vf.after : isdirectory(v:val.after) ? v:val.after : ""')
|
||||||
|
@ -255,35 +261,4 @@ function! pathogen#runtime_findfile(file,count) abort
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Section: Deprecated
|
|
||||||
|
|
||||||
function! s:warn(msg) abort
|
|
||||||
echohl WarningMsg
|
|
||||||
echomsg a:msg
|
|
||||||
echohl NONE
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Prepend all subdirectories of path to the rtp, and append all 'after'
|
|
||||||
" directories in those subdirectories. Deprecated.
|
|
||||||
function! pathogen#runtime_prepend_subdirectories(path) abort
|
|
||||||
call s:warn('Change pathogen#runtime_prepend_subdirectories('.string(a:path).') to pathogen#infect('.string(a:path.'/{}').')')
|
|
||||||
return pathogen#surround(a:path . pathogen#slash() . '{}')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! pathogen#incubate(...) abort
|
|
||||||
let name = a:0 ? a:1 : 'bundle/{}'
|
|
||||||
call s:warn('Change pathogen#incubate('.(a:0 ? string(a:1) : '').') to pathogen#infect('.string(name).')')
|
|
||||||
return pathogen#interpose(name)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Deprecated alias for pathogen#interpose().
|
|
||||||
function! pathogen#runtime_append_all_bundles(...) abort
|
|
||||||
if a:0
|
|
||||||
call s:warn('Change pathogen#runtime_append_all_bundles('.string(a:1).') to pathogen#infect('.string(a:1.'/{}').')')
|
|
||||||
else
|
|
||||||
call s:warn('Change pathogen#runtime_append_all_bundles() to pathogen#infect()')
|
|
||||||
endif
|
|
||||||
return pathogen#interpose(a:0 ? a:1 . '/{}' : 'bundle/{}')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" vim:set et sw=2 foldmethod=expr foldexpr=getline(v\:lnum)=~'^\"\ Section\:'?'>1'\:getline(v\:lnum)=~#'^fu'?'a1'\:getline(v\:lnum)=~#'^endf'?'s1'\:'=':
|
" vim:set et sw=2 foldmethod=expr foldexpr=getline(v\:lnum)=~'^\"\ Section\:'?'>1'\:getline(v\:lnum)=~#'^fu'?'a1'\:getline(v\:lnum)=~#'^endf'?'s1'\:'=':
|
||||||
|
|
Loading…
Reference in a new issue