Mercurial > ec-dotfiles
comparison vendor/vim-autoload/pathogen.vim @ 589:7fbadf8bd22e
Update vendor
Change whatever available from official vim
author | nanaya <me@myconan.net> |
---|---|
date | Thu, 07 Jul 2016 15:59:06 +0900 |
parents | a163d6875651 |
children | 0e72765944d4 |
comparison
equal
deleted
inserted
replaced
588:152c020d7d8e | 589:7fbadf8bd22e |
---|---|
1 " pathogen.vim - path option manipulation | 1 " pathogen.vim - path option manipulation |
2 " Maintainer: Tim Pope <http://tpo.pe/> | 2 " Maintainer: Tim Pope <http://tpo.pe/> |
3 " Version: 2.3 | 3 " Version: 2.4 |
4 | 4 |
5 " Install in ~/.vim/autoload (or ~\vimfiles\autoload). | 5 " Install in ~/.vim/autoload (or ~\vimfiles\autoload). |
6 " | 6 " |
7 " For management of individually installed plugins in ~/.vim/bundle (or | 7 " For management of individually installed plugins in ~/.vim/bundle (or |
8 " ~\vimfiles\bundle), adding `execute pathogen#infect()` to the top of your | 8 " ~\vimfiles\bundle), adding `execute pathogen#infect()` to the top of your |
88 filetype on | 88 filetype on |
89 endif | 89 endif |
90 endfunction | 90 endfunction |
91 | 91 |
92 " Check if a bundle is disabled. A bundle is considered disabled if its | 92 " Check if a bundle is disabled. A bundle is considered disabled if its |
93 " basename or full name is included in the list g:pathogen_disabled. | 93 " basename or full name is included in the list g:pathogen_blacklist or the |
94 " comma delimited environment variable $VIMBLACKLIST. | |
94 function! pathogen#is_disabled(path) abort | 95 function! pathogen#is_disabled(path) abort |
95 if a:path =~# '\~$' | 96 if a:path =~# '\~$' |
96 return 1 | 97 return 1 |
97 endif | 98 endif |
98 let sep = pathogen#slash() | 99 let sep = pathogen#slash() |
99 let blacklist = map( | 100 let blacklist = |
100 \ get(g:, 'pathogen_blacklist', get(g:, 'pathogen_disabled', [])) + | 101 \ get(g:, 'pathogen_blacklist', get(g:, 'pathogen_disabled', [])) + |
101 \ pathogen#split($VIMBLACKLIST), | 102 \ pathogen#split($VIMBLACKLIST) |
102 \ 'substitute(v:val, "[\\/]$", "", "")') | 103 if !empty(blacklist) |
104 call map(blacklist, 'substitute(v:val, "[\\/]$", "", "")') | |
105 endif | |
103 return index(blacklist, fnamemodify(a:path, ':t')) != -1 || index(blacklist, a:path) != -1 | 106 return index(blacklist, fnamemodify(a:path, ':t')) != -1 || index(blacklist, a:path) != -1 |
104 endfunction "}}}1 | 107 endfunction |
105 | 108 |
106 " Prepend the given directory to the runtime path and append its corresponding | 109 " Prepend the given directory to the runtime path and append its corresponding |
107 " after directory. Curly braces are expanded with pathogen#expand(). | 110 " after directory. Curly braces are expanded with pathogen#expand(). |
108 function! pathogen#surround(path) abort | 111 function! pathogen#surround(path) abort |
109 let sep = pathogen#slash() | 112 let sep = pathogen#slash() |
110 let rtp = pathogen#split(&rtp) | 113 let rtp = pathogen#split(&rtp) |
111 let path = fnamemodify(a:path, ':p:?[\\/]\=$??') | 114 let path = fnamemodify(a:path, ':s?[\\/]\=$??') |
112 let before = filter(pathogen#expand(path), '!pathogen#is_disabled(v:val)') | 115 let before = filter(pathogen#expand(path), '!pathogen#is_disabled(v:val)') |
113 let after = filter(reverse(pathogen#expand(path.sep.'after')), '!pathogen#is_disabled(v:val[0:-7])') | 116 let after = filter(reverse(pathogen#expand(path, sep.'after')), '!pathogen#is_disabled(v:val[0:-7])') |
114 call filter(rtp, 'index(before + after, v:val) == -1') | 117 call filter(rtp, 'index(before + after, v:val) == -1') |
115 let &rtp = pathogen#join(before, rtp, after) | 118 let &rtp = pathogen#join(before, rtp, after) |
116 return &rtp | 119 return &rtp |
117 endfunction | 120 endfunction |
118 | 121 |
126 endif | 129 endif |
127 let s:done_bundles[name] = 1 | 130 let s:done_bundles[name] = 1 |
128 let list = [] | 131 let list = [] |
129 for dir in pathogen#split(&rtp) | 132 for dir in pathogen#split(&rtp) |
130 if dir =~# '\<after$' | 133 if dir =~# '\<after$' |
131 let list += reverse(filter(pathogen#expand(dir[0:-6].name.sep.'after'), '!pathogen#is_disabled(v:val[0:-7])')) + [dir] | 134 let list += reverse(filter(pathogen#expand(dir[0:-6].name, sep.'after'), '!pathogen#is_disabled(v:val[0:-7])')) + [dir] |
132 else | 135 else |
133 let list += [dir] + filter(pathogen#expand(dir.sep.name), '!pathogen#is_disabled(v:val)') | 136 let list += [dir] + filter(pathogen#expand(dir.sep.name), '!pathogen#is_disabled(v:val)') |
134 endif | 137 endif |
135 endfor | 138 endfor |
136 let &rtp = pathogen#join(pathogen#uniq(list)) | 139 let &rtp = pathogen#join(pathogen#uniq(list)) |
169 | 172 |
170 " Given a string, returns all possible permutations of comma delimited braced | 173 " Given a string, returns all possible permutations of comma delimited braced |
171 " alternatives of that string. pathogen#expand('/{a,b}/{c,d}') yields | 174 " alternatives of that string. pathogen#expand('/{a,b}/{c,d}') yields |
172 " ['/a/c', '/a/d', '/b/c', '/b/d']. Empty braces are treated as a wildcard | 175 " ['/a/c', '/a/d', '/b/c', '/b/d']. Empty braces are treated as a wildcard |
173 " and globbed. Actual globs are preserved. | 176 " and globbed. Actual globs are preserved. |
174 function! pathogen#expand(pattern) abort | 177 function! pathogen#expand(pattern, ...) abort |
178 let after = a:0 ? a:1 : '' | |
175 if a:pattern =~# '{[^{}]\+}' | 179 if a:pattern =~# '{[^{}]\+}' |
176 let [pre, pat, post] = split(substitute(a:pattern, '\(.\{-\}\){\([^{}]\+\)}\(.*\)', "\\1\001\\2\001\\3", ''), "\001", 1) | 180 let [pre, pat, post] = split(substitute(a:pattern, '\(.\{-\}\){\([^{}]\+\)}\(.*\)', "\\1\001\\2\001\\3", ''), "\001", 1) |
177 let found = map(split(pat, ',', 1), 'pre.v:val.post') | 181 let found = map(split(pat, ',', 1), 'pre.v:val.post') |
178 let results = [] | 182 let results = [] |
179 for pattern in found | 183 for pattern in found |
180 call extend(results, pathogen#expand(pattern)) | 184 call extend(results, pathogen#expand(pattern)) |
181 endfor | 185 endfor |
182 return results | |
183 elseif a:pattern =~# '{}' | 186 elseif a:pattern =~# '{}' |
184 let pat = matchstr(a:pattern, '^.*{}[^*]*\%($\|[\\/]\)') | 187 let pat = matchstr(a:pattern, '^.*{}[^*]*\%($\|[\\/]\)') |
185 let post = a:pattern[strlen(pat) : -1] | 188 let post = a:pattern[strlen(pat) : -1] |
186 return map(split(glob(substitute(pat, '{}', '*', 'g')), "\n"), 'v:val.post') | 189 let results = map(split(glob(substitute(pat, '{}', '*', 'g')), "\n"), 'v:val.post') |
187 else | 190 else |
188 return [a:pattern] | 191 let results = [a:pattern] |
189 endif | 192 endif |
193 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 : ""') | |
195 return filter(results, '!empty(v:val)') | |
190 endfunction | 196 endfunction |
191 | 197 |
192 " \ on Windows unless shellslash is set, / everywhere else. | 198 " \ on Windows unless shellslash is set, / everywhere else. |
193 function! pathogen#slash() abort | 199 function! pathogen#slash() abort |
194 return !exists("+shellslash") || &shellslash ? '/' : '\' | 200 return !exists("+shellslash") || &shellslash ? '/' : '\' |
200 | 206 |
201 " Convenience wrapper around glob() which returns a list. | 207 " Convenience wrapper around glob() which returns a list. |
202 function! pathogen#glob(pattern) abort | 208 function! pathogen#glob(pattern) abort |
203 let files = split(glob(a:pattern),"\n") | 209 let files = split(glob(a:pattern),"\n") |
204 return map(files,'substitute(v:val,"[".pathogen#slash()."/]$","","")') | 210 return map(files,'substitute(v:val,"[".pathogen#slash()."/]$","","")') |
205 endfunction "}}}1 | 211 endfunction |
206 | 212 |
207 " Like pathogen#glob(), only limit the results to directories. | 213 " Like pathogen#glob(), only limit the results to directories. |
208 function! pathogen#glob_directories(pattern) abort | 214 function! pathogen#glob_directories(pattern) abort |
209 return filter(pathogen#glob(a:pattern),'isdirectory(v:val)') | 215 return filter(pathogen#glob(a:pattern),'isdirectory(v:val)') |
210 endfunction "}}}1 | 216 endfunction |
211 | 217 |
212 " Remove duplicates from a list. | 218 " Remove duplicates from a list. |
213 function! pathogen#uniq(list) abort | 219 function! pathogen#uniq(list) abort |
214 let i = 0 | 220 let i = 0 |
215 let seen = {} | 221 let seen = {} |
237 return substitute(escape(a:string," \t\n*?[{`$\\%#'\"|!<"),'^[+>]','\\&','') | 243 return substitute(escape(a:string," \t\n*?[{`$\\%#'\"|!<"),'^[+>]','\\&','') |
238 endif | 244 endif |
239 endfunction | 245 endfunction |
240 | 246 |
241 " Like findfile(), but hardcoded to use the runtimepath. | 247 " Like findfile(), but hardcoded to use the runtimepath. |
242 function! pathogen#runtime_findfile(file,count) abort "{{{1 | 248 function! pathogen#runtime_findfile(file,count) abort |
243 let rtp = pathogen#join(1,pathogen#split(&rtp)) | 249 let rtp = pathogen#join(1,pathogen#split(&rtp)) |
244 let file = findfile(a:file,rtp,a:count) | 250 let file = findfile(a:file,rtp,a:count) |
245 if file ==# '' | 251 if file ==# '' |
246 return '' | 252 return '' |
247 else | 253 else |