comparison vendor/vim-autoload/pathogen.vim @ 612:b305f2ce5f88

Update vendored files
author nanaya <me@nanaya.pro>
date Mon, 02 Apr 2018 17:34:40 +0900
parents 0e72765944d4
children c74dffea6a0a
comparison
equal deleted inserted replaced
611:96a7b2a3e774 612:b305f2ce5f88
14 finish 14 finish
15 endif 15 endif
16 let g:loaded_pathogen = 1 16 let g:loaded_pathogen = 1
17 17
18 " Point of entry for basic default usage. Give a relative path to invoke 18 " Point of entry for basic default usage. Give a relative path to invoke
19 " pathogen#interpose() (defaults to "bundle/{}"), or an absolute path to invoke 19 " pathogen#interpose() or an absolute path to invoke pathogen#surround().
20 " pathogen#surround(). Curly braces are expanded with pathogen#expand(): 20 " Curly braces are expanded with pathogen#expand(): "bundle/{}" finds all
21 " "bundle/{}" finds all subdirectories inside "bundle" inside all directories 21 " subdirectories inside "bundle" inside all directories in the runtime path.
22 " in the runtime path. 22 " If no arguments are given, defaults "bundle/{}", and also "pack/{}/start/{}"
23 " on versions of Vim without native package support.
23 function! pathogen#infect(...) abort 24 function! pathogen#infect(...) abort
24 for path in a:0 ? filter(reverse(copy(a:000)), 'type(v:val) == type("")') : ['bundle/{}'] 25 if a:0
25 if path =~# '^\%({\=[$~\\/]\|{\=\w:[\\/]\).*[{}*]' 26 let paths = filter(reverse(copy(a:000)), 'type(v:val) == type("")')
27 else
28 let paths = ['bundle/{}', 'pack/{}/start/{}']
29 endif
30 if has('packages')
31 call filter(paths, 'v:val !~# "^pack/[^/]*/start/[^/]*$"')
32 endif
33 let static = '^\%([$~\\/]\|\w:[\\/]\)[^{}*]*$'
34 for path in filter(copy(paths), 'v:val =~# static')
35 call pathogen#surround(path)
36 endfor
37 for path in filter(copy(paths), 'v:val !~# static')
38 if path =~# '^\%([$~\\/]\|\w:[\\/]\)'
26 call pathogen#surround(path) 39 call pathogen#surround(path)
27 elseif path =~# '^\%([$~\\/]\|\w:[\\/]\)' 40 else
28 call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')')
29 call pathogen#surround(path . '/{}')
30 elseif path =~# '[{}*]'
31 call pathogen#interpose(path) 41 call pathogen#interpose(path)
32 else
33 call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')')
34 call pathogen#interpose(path . '/{}')
35 endif 42 endif
36 endfor 43 endfor
37 call pathogen#cycle_filetype() 44 call pathogen#cycle_filetype()
38 if pathogen#is_disabled($MYVIMRC) 45 if pathogen#is_disabled($MYVIMRC)
39 return 'finish' 46 return 'finish'
95 function! pathogen#is_disabled(path) abort 102 function! pathogen#is_disabled(path) abort
96 if a:path =~# '\~$' 103 if a:path =~# '\~$'
97 return 1 104 return 1
98 endif 105 endif
99 let sep = pathogen#slash() 106 let sep = pathogen#slash()
100 let blacklist = 107 let blacklist = get(g:, 'pathogen_blacklist', get(g:, 'pathogen_disabled', [])) + pathogen#split($VIMBLACKLIST)
101 \ get(g:, 'pathogen_blacklist', get(g:, 'pathogen_disabled', [])) +
102 \ pathogen#split($VIMBLACKLIST)
103 if !empty(blacklist) 108 if !empty(blacklist)
104 call map(blacklist, 'substitute(v:val, "[\\/]$", "", "")') 109 call map(blacklist, 'substitute(v:val, "[\\/]$", "", "")')
105 endif 110 endif
106 return index(blacklist, fnamemodify(a:path, ':t')) != -1 || index(blacklist, a:path) != -1 111 return index(blacklist, fnamemodify(a:path, ':t')) != -1 || index(blacklist, a:path) != -1
107 endfunction 112 endfunction
174 " alternatives of that string. pathogen#expand('/{a,b}/{c,d}') yields 179 " alternatives of that string. pathogen#expand('/{a,b}/{c,d}') yields
175 " ['/a/c', '/a/d', '/b/c', '/b/d']. Empty braces are treated as a wildcard 180 " ['/a/c', '/a/d', '/b/c', '/b/d']. Empty braces are treated as a wildcard
176 " and globbed. Actual globs are preserved. 181 " and globbed. Actual globs are preserved.
177 function! pathogen#expand(pattern, ...) abort 182 function! pathogen#expand(pattern, ...) abort
178 let after = a:0 ? a:1 : '' 183 let after = a:0 ? a:1 : ''
179 if a:pattern =~# '{[^{}]\+}' 184 let pattern = substitute(a:pattern, '^[~$][^\/]*', '\=expand(submatch(0))', '')
180 let [pre, pat, post] = split(substitute(a:pattern, '\(.\{-\}\){\([^{}]\+\)}\(.*\)', "\\1\001\\2\001\\3", ''), "\001", 1) 185 if pattern =~# '{[^{}]\+}'
186 let [pre, pat, post] = split(substitute(pattern, '\(.\{-\}\){\([^{}]\+\)}\(.*\)', "\\1\001\\2\001\\3", ''), "\001", 1)
181 let found = map(split(pat, ',', 1), 'pre.v:val.post') 187 let found = map(split(pat, ',', 1), 'pre.v:val.post')
182 let results = [] 188 let results = []
183 for pattern in found 189 for pattern in found
184 call extend(results, pathogen#expand(pattern)) 190 call extend(results, pathogen#expand(pattern))
185 endfor 191 endfor
186 elseif a:pattern =~# '{}' 192 elseif pattern =~# '{}'
187 let pat = matchstr(a:pattern, '^.*{}[^*]*\%($\|[\\/]\)') 193 let pat = matchstr(pattern, '^.*{}[^*]*\%($\|[\\/]\)')
188 let post = a:pattern[strlen(pat) : -1] 194 let post = pattern[strlen(pat) : -1]
189 let results = map(split(glob(substitute(pat, '{}', '*', 'g')), "\n"), 'v:val.post') 195 let results = map(split(glob(substitute(pat, '{}', '*', 'g')), "\n"), 'v:val.post')
190 else 196 else
191 let results = [a:pattern] 197 let results = [pattern]
192 endif 198 endif
193 let vf = pathogen#slash() . 'vimfiles' 199 let vf = pathogen#slash() . 'vimfiles'
194 call map(results, 'v:val =~# "\\*" ? v:val.after : isdirectory(v:val.vf.after) ? v:val.vf.after : isdirectory(v:val.after) ? v:val.after : ""') 200 call map(results, 'v:val =~# "\\*" ? v:val.after : isdirectory(v:val.vf.after) ? v:val.vf.after : isdirectory(v:val.after) ? v:val.after : ""')
195 return filter(results, '!empty(v:val)') 201 return filter(results, '!empty(v:val)')
196 endfunction 202 endfunction
253 else 259 else
254 return fnamemodify(file,':p') 260 return fnamemodify(file,':p')
255 endif 261 endif
256 endfunction 262 endfunction
257 263
258 " Section: Deprecated
259
260 function! s:warn(msg) abort
261 echohl WarningMsg
262 echomsg a:msg
263 echohl NONE
264 endfunction
265
266 " Prepend all subdirectories of path to the rtp, and append all 'after'
267 " directories in those subdirectories. Deprecated.
268 function! pathogen#runtime_prepend_subdirectories(path) abort
269 call s:warn('Change pathogen#runtime_prepend_subdirectories('.string(a:path).') to pathogen#infect('.string(a:path.'/{}').')')
270 return pathogen#surround(a:path . pathogen#slash() . '{}')
271 endfunction
272
273 function! pathogen#incubate(...) abort
274 let name = a:0 ? a:1 : 'bundle/{}'
275 call s:warn('Change pathogen#incubate('.(a:0 ? string(a:1) : '').') to pathogen#infect('.string(name).')')
276 return pathogen#interpose(name)
277 endfunction
278
279 " Deprecated alias for pathogen#interpose().
280 function! pathogen#runtime_append_all_bundles(...) abort
281 if a:0
282 call s:warn('Change pathogen#runtime_append_all_bundles('.string(a:1).') to pathogen#infect('.string(a:1.'/{}').')')
283 else
284 call s:warn('Change pathogen#runtime_append_all_bundles() to pathogen#infect()')
285 endif
286 return pathogen#interpose(a:0 ? a:1 . '/{}' : 'bundle/{}')
287 endfunction
288
289 " vim:set et sw=2 foldmethod=expr foldexpr=getline(v\:lnum)=~'^\"\ Section\:'?'>1'\:getline(v\:lnum)=~#'^fu'?'a1'\:getline(v\:lnum)=~#'^endf'?'s1'\:'=': 264 " vim:set et sw=2 foldmethod=expr foldexpr=getline(v\:lnum)=~'^\"\ Section\:'?'>1'\:getline(v\:lnum)=~#'^fu'?'a1'\:getline(v\:lnum)=~#'^endf'?'s1'\:'=':