Skip to content

Commit f66e6f4

Browse files
committed
Try a fold expression
1 parent bd0c1ab commit f66e6f4

File tree

1 file changed

+42
-45
lines changed

1 file changed

+42
-45
lines changed

autoload/pathogen.vim

Lines changed: 42 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
" ~\vimfiles\bundle), adding `execute pathogen#infect()` to the top of your
99
" .vimrc is the only other setup necessary.
1010
"
11-
" The API is documented inline below. For maximum ease of reading,
12-
" :set foldmethod=marker
11+
" The API is documented inline below.
1312

1413
if exists("g:loaded_pathogen") || &cp
1514
finish
@@ -21,7 +20,7 @@ let g:loaded_pathogen = 1
2120
" pathogen#surround(). For backwards compatibility purposes, a full path that
2221
" does not end in {} or * is given to pathogen#runtime_prepend_subdirectories()
2322
" instead.
24-
function! pathogen#infect(...) abort " {{{1
23+
function! pathogen#infect(...) abort
2524
for path in a:0 ? filter(reverse(copy(a:000)), 'type(v:val) == type("")') : ['bundle/{}']
2625
if path =~# '^[^\\/]\+$'
2726
call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')')
@@ -37,17 +36,17 @@ function! pathogen#infect(...) abort " {{{1
3736
endfor
3837
call pathogen#cycle_filetype()
3938
return ''
40-
endfunction " }}}1
39+
endfunction
4140

4241
" Split a path into a list.
43-
function! pathogen#split(path) abort " {{{1
42+
function! pathogen#split(path) abort
4443
if type(a:path) == type([]) | return a:path | endif
4544
let split = split(a:path,'\\\@<!\%(\\\\\)*\zs,')
4645
return map(split,'substitute(v:val,''\\\([\\,]\)'',''\1'',"g")')
47-
endfunction " }}}1
46+
endfunction
4847

4948
" Convert a list to a path.
50-
function! pathogen#join(...) abort " {{{1
49+
function! pathogen#join(...) abort
5150
if type(a:1) == type(1) && a:1
5251
let i = 1
5352
let space = ' '
@@ -71,24 +70,24 @@ function! pathogen#join(...) abort " {{{1
7170
let i += 1
7271
endwhile
7372
return substitute(path,'^,','','')
74-
endfunction " }}}1
73+
endfunction
7574

7675
" Convert a list to a path with escaped spaces for 'path', 'tag', etc.
77-
function! pathogen#legacyjoin(...) abort " {{{1
76+
function! pathogen#legacyjoin(...) abort
7877
return call('pathogen#join',[1] + a:000)
79-
endfunction " }}}1
78+
endfunction
8079

8180
" Turn filetype detection off and back on again if it was already enabled.
82-
function! pathogen#cycle_filetype() " {{{1
81+
function! pathogen#cycle_filetype() abort
8382
if exists('g:did_load_filetypes')
8483
filetype off
8584
filetype on
8685
endif
87-
endfunction " }}}1
86+
endfunction
8887

8988
" Check if a bundle is disabled. A bundle is considered disabled if its
9089
" basename or full name is included in the list g:pathogen_disabled.
91-
function! pathogen#is_disabled(path) abort " {{{1
90+
function! pathogen#is_disabled(path) abort
9291
let sep = pathogen#slash()
9392
let blacklist = get(g:, 'pathogen_blacklist', get(g:, 'pathogen_disabled', []))
9493
return index(blacklist, fnamemodify(a:path, ':t')) != -1 || index(blacklist, a:path) != -1
@@ -98,7 +97,7 @@ endfunction "}}}1
9897
" after directory. If the directory is already included, move it to the
9998
" outermost position. Wildcards are added as is. Ending a path in /{} causes
10099
" all subdirectories to be added (except those in g:pathogen_disabled).
101-
function! pathogen#surround(path) abort " {{{1
100+
function! pathogen#surround(path) abort
102101
let sep = pathogen#slash()
103102
let rtp = pathogen#split(&rtp)
104103
if a:path =~# '[\\/]{}$'
@@ -114,12 +113,12 @@ function! pathogen#surround(path) abort " {{{1
114113
endif
115114
let &rtp = pathogen#join(before, rtp, after)
116115
return &rtp
117-
endfunction " }}}1
116+
endfunction
118117

119118
" For each directory in the runtime path, add a second entry with the given
120119
" argument appended. If the argument ends in '/{}', add a separate entry for
121120
" each subdirectory.
122-
function! pathogen#interpose(name) abort " {{{1
121+
function! pathogen#interpose(name) abort
123122
let sep = pathogen#slash()
124123
let name = a:name
125124
if has_key(s:done_bundles, name)
@@ -148,10 +147,8 @@ endfunction
148147

149148
let s:done_bundles = {}
150149

151-
" }}}1
152-
153150
" Invoke :helptags on all non-$VIM doc directories in runtimepath.
154-
function! pathogen#helptags() abort " {{{1
151+
function! pathogen#helptags() abort
155152
let sep = pathogen#slash()
156153
for glob in pathogen#split(&rtp)
157154
for dir in map(split(glob(glob), "\n"), 'v:val.sep."/doc/".sep')
@@ -160,42 +157,42 @@ function! pathogen#helptags() abort " {{{1
160157
endif
161158
endfor
162159
endfor
163-
endfunction " }}}1
160+
endfunction
164161

165162
command! -bar Helptags :call pathogen#helptags()
166163

167164
" Execute the given command. This is basically a backdoor for --remote-expr.
168-
function! pathogen#execute(...) abort " {{{1
165+
function! pathogen#execute(...) abort
169166
for command in a:000
170167
execute command
171168
endfor
172169
return ''
173-
endfunction " }}}1
170+
endfunction
174171

175172
" Section: Unofficial
176173

177174
" \ on Windows unless shellslash is set, / everywhere else.
178-
function! pathogen#slash() abort " {{{1
175+
function! pathogen#slash() abort
179176
return !exists("+shellslash") || &shellslash ? '/' : '\'
180-
endfunction " }}}1
177+
endfunction
181178

182-
function! pathogen#separator() abort " {{{1
179+
function! pathogen#separator() abort
183180
return pathogen#slash()
184-
endfunction " }}}1
181+
endfunction
185182

186183
" Convenience wrapper around glob() which returns a list.
187-
function! pathogen#glob(pattern) abort " {{{1
184+
function! pathogen#glob(pattern) abort
188185
let files = split(glob(a:pattern),"\n")
189186
return map(files,'substitute(v:val,"[".pathogen#slash()."/]$","","")')
190187
endfunction "}}}1
191188

192189
" Like pathogen#glob(), only limit the results to directories.
193-
function! pathogen#glob_directories(pattern) abort " {{{1
190+
function! pathogen#glob_directories(pattern) abort
194191
return filter(pathogen#glob(a:pattern),'isdirectory(v:val)')
195192
endfunction "}}}1
196193

197194
" Remove duplicates from a list.
198-
function! pathogen#uniq(list) abort " {{{1
195+
function! pathogen#uniq(list) abort
199196
let i = 0
200197
let seen = {}
201198
while i < len(a:list)
@@ -210,18 +207,18 @@ function! pathogen#uniq(list) abort " {{{1
210207
endif
211208
endwhile
212209
return a:list
213-
endfunction " }}}1
210+
endfunction
214211

215212
" Backport of fnameescape().
216-
function! pathogen#fnameescape(string) abort " {{{1
213+
function! pathogen#fnameescape(string) abort
217214
if exists('*fnameescape')
218215
return fnameescape(a:string)
219216
elseif a:string ==# '-'
220217
return '\-'
221218
else
222219
return substitute(escape(a:string," \t\n*?[{`$\\%#'\"|!<"),'^[+>]','\\&','')
223220
endif
224-
endfunction " }}}1
221+
endfunction
225222

226223
" Like findfile(), but hardcoded to use the runtimepath.
227224
function! pathogen#runtime_findfile(file,count) abort "{{{1
@@ -232,46 +229,46 @@ function! pathogen#runtime_findfile(file,count) abort "{{{1
232229
else
233230
return fnamemodify(file,':p')
234231
endif
235-
endfunction " }}}1
232+
endfunction
236233

237234
" Section: Deprecated
238235

239-
function! s:warn(msg)
236+
function! s:warn(msg) abort
240237
echohl WarningMsg
241238
echomsg a:msg
242239
echohl NONE
243240
endfunction
244241

245242
" Prepend all subdirectories of path to the rtp, and append all 'after'
246243
" directories in those subdirectories. Deprecated.
247-
function! pathogen#runtime_prepend_subdirectories(path) " {{{1
244+
function! pathogen#runtime_prepend_subdirectories(path) abort
248245
call s:warn('Change pathogen#runtime_prepend_subdirectories('.string(a:path).') to pathogen#infect('.string(a:path.'/{}').')')
249246
return pathogen#surround(a:path . pathogen#slash() . '{}')
250-
endfunction " }}}1
247+
endfunction
251248

252-
function! pathogen#incubate(...) abort " {{{1
249+
function! pathogen#incubate(...) abort
253250
let name = a:0 ? a:1 : 'bundle/{}'
254251
call s:warn('Change pathogen#incubate('.(a:0 ? string(a:1) : '').') to pathogen#infect('.string(name).')')
255252
return pathogen#interpose(name)
256-
endfunction " }}}1
253+
endfunction
257254

258255
" Deprecated alias for pathogen#interpose().
259-
function! pathogen#runtime_append_all_bundles(...) abort " {{{1
256+
function! pathogen#runtime_append_all_bundles(...) abort
260257
if a:0
261258
call s:warn('Change pathogen#runtime_append_all_bundles('.string(a:1).') to pathogen#infect('.string(a:1.'/{}').')')
262259
else
263260
call s:warn('Change pathogen#runtime_append_all_bundles() to pathogen#infect()')
264261
endif
265262
return pathogen#interpose(a:0 ? a:1 . '/{}' : 'bundle/{}')
266-
endfunction " }}}1
263+
endfunction
267264

268265
if exists(':Vedit')
269266
finish
270267
endif
271268

272269
let s:vopen_warning = 0
273270

274-
function! s:find(count,cmd,file,lcd) " {{{1
271+
function! s:find(count,cmd,file,lcd)
275272
let rtp = pathogen#join(1,pathogen#split(&runtimepath))
276273
let file = pathogen#runtime_findfile(a:file,a:count)
277274
if file ==# ''
@@ -290,9 +287,9 @@ function! s:find(count,cmd,file,lcd) " {{{1
290287
else
291288
return a:cmd.' '.pathogen#fnameescape(file) . warning
292289
endif
293-
endfunction " }}}1
290+
endfunction
294291

295-
function! s:Findcomplete(A,L,P) " {{{1
292+
function! s:Findcomplete(A,L,P)
296293
let sep = pathogen#slash()
297294
let cheats = {
298295
\'a': 'autoload',
@@ -318,7 +315,7 @@ function! s:Findcomplete(A,L,P) " {{{1
318315
endfor
319316
endfor
320317
return sort(keys(found))
321-
endfunction " }}}1
318+
endfunction
322319

323320
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Ve :execute s:find(<count>,'edit<bang>',<q-args>,0)
324321
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vedit :execute s:find(<count>,'edit<bang>',<q-args>,0)
@@ -329,4 +326,4 @@ command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vtabed
329326
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit :execute s:find(<count>,'pedit',<q-args>,<bang>1)
330327
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vread :execute s:find(<count>,'read',<q-args>,<bang>1)
331328

332-
" vim:set et sw=2:
329+
" vim:set et sw=2 foldmethod=expr foldexpr=getline(v\:lnum)=~'^\"\ Section\:'?'>1'\:getline(v\:lnum)=~#'^fu'?'a1'\:getline(v\:lnum)=~#'^endf'?'s1'\:'=':

0 commit comments

Comments
 (0)