@@ -166,7 +166,7 @@ let s:done_bundles = ''
166
166
function ! pathogen#helptags () " {{{1
167
167
let sep = pathogen#separator ()
168
168
for dir in pathogen#split (&rtp )
169
- if (dir .sep)[0 : strlen ($VIMRUNTIME )] !=# $VIMRUNTIME .sep && filewritable (dir .sep.' doc' ) == 2 && ! empty (glob (dir .sep.' doc' .sep.' *' )) && (! filereadable (dir .sep.' doc' .sep.' tags' ) || filewritable (dir .sep.' doc' .sep.' tags' ))
169
+ if (dir .sep)[0 : strlen ($VIMRUNTIME )] !=# $VIMRUNTIME .sep && filewritable (dir .sep.' doc' ) == 2 && ! empty (filter ( split ( glob (dir .sep.' doc' .sep.' *' ), " \n > " ), ' !isdirectory(v:val) ' )) && (! filereadable (dir .sep.' doc' .sep.' tags' ) || filewritable (dir .sep.' doc' .sep.' tags' ))
170
170
helptags `= dir .' /doc' `
171
171
endif
172
172
endfor
@@ -180,6 +180,17 @@ function! pathogen#runtime_findfile(file,count) "{{{1
180
180
return fnamemodify (findfile (a: file ,rtp ,a: count ),' :p' )
181
181
endfunction " }}}1
182
182
183
+ " Backport of fnameescape().
184
+ function ! pathogen#fnameescape (string ) " {{{1
185
+ if exists (' *fnameescape' )
186
+ return fnameescape (a: string )
187
+ elseif a: string == # ' -'
188
+ return ' \-'
189
+ else
190
+ return substitute (escape (a: string ," \t \n *?[{`$\\ %#'\" |!<" ),' ^[+>]' ,' \\&' ,' ' )
191
+ endif
192
+ endfunction " }}}1
193
+
183
194
function ! s: find (count ,cmd,file ,lcd ) " {{{1
184
195
let rtp = pathogen#join (1 ,pathogen#split (&runtimepath ))
185
196
let file = pathogen#runtime_findfile (a: file ,a: count )
@@ -188,9 +199,9 @@ function! s:find(count,cmd,file,lcd) " {{{1
188
199
elseif a: lcd
189
200
let path = file [0 :- strlen (a: file )-2 ]
190
201
execute ' lcd `=path`'
191
- return a: cmd .' ' .fnameescape (a: file )
202
+ return a: cmd .' ' .pathogen# fnameescape (a: file )
192
203
else
193
- return a: cmd .' ' .fnameescape (file )
204
+ return a: cmd .' ' .pathogen# fnameescape (file )
194
205
endif
195
206
endfunction " }}}1
196
207
@@ -211,23 +222,24 @@ function! s:Findcomplete(A,L,P) " {{{1
211
222
let pattern = substitute (request,' \' .sep,' *' .sep,' g' ).' *'
212
223
let found = {}
213
224
for path in pathogen#split (&runtimepath )
225
+ let path = expand (path , ' :p' )
214
226
let matches = split (glob (path .sep.pattern)," \n " )
215
227
call map (matches,' isdirectory(v:val) ? v:val.sep : v:val' )
216
- call map (matches,' v:val[strlen(path)+1:-1]' )
228
+ call map (matches,' expand( v:val, ":p") [strlen(path)+1:-1]' )
217
229
for match in matches
218
230
let found[match ] = 1
219
231
endfor
220
232
endfor
221
233
return sort (keys (found))
222
234
endfunction " }}}1
223
235
224
- command ! - bar - bang -count =1 -nargs =1 -complete =customlist ,s: Findcomplete Ve :execute s: find (<count> ,' edit<bang>' ,<q-args> ,0 )
225
- command ! - bar - bang -count =1 -nargs =1 -complete =customlist ,s: Findcomplete Vedit :execute s: find (<count> ,' edit<bang>' ,<q-args> ,0 )
226
- command ! - bar - bang -count =1 -nargs =1 -complete =customlist ,s: Findcomplete Vopen :execute s: find (<count> ,' edit<bang>' ,<q-args> ,1 )
227
- command ! - bar - bang -count =1 -nargs =1 -complete =customlist ,s: Findcomplete Vsplit :execute s: find (<count> ,' split' ,<q-args> ,<bang> 1 )
228
- command ! - bar - bang -count =1 -nargs =1 -complete =customlist ,s: Findcomplete Vvsplit :execute s: find (<count> ,' vsplit' ,<q-args> ,<bang> 1 )
229
- command ! - bar - bang -count =1 -nargs =1 -complete =customlist ,s: Findcomplete Vtabedit :execute s: find (<count> ,' tabedit' ,<q-args> ,<bang> 1 )
230
- command ! - bar - bang -count =1 -nargs =1 -complete =customlist ,s: Findcomplete Vpedit :execute s: find (<count> ,' pedit' ,<q-args> ,<bang> 1 )
231
- command ! - bar - bang -count =1 -nargs =1 -complete =customlist ,s: Findcomplete Vread :execute s: find (<count> ,' read' ,<q-args> ,<bang> 1 )
236
+ command ! - bar - bang -range =1 -nargs =1 -complete =customlist ,s: Findcomplete Ve :execute s: find (<count> ,' edit<bang>' ,<q-args> ,0 )
237
+ command ! - bar - bang -range =1 -nargs =1 -complete =customlist ,s: Findcomplete Vedit :execute s: find (<count> ,' edit<bang>' ,<q-args> ,0 )
238
+ command ! - bar - bang -range =1 -nargs =1 -complete =customlist ,s: Findcomplete Vopen :execute s: find (<count> ,' edit<bang>' ,<q-args> ,1 )
239
+ command ! - bar - bang -range =1 -nargs =1 -complete =customlist ,s: Findcomplete Vsplit :execute s: find (<count> ,' split' ,<q-args> ,<bang> 1 )
240
+ command ! - bar - bang -range =1 -nargs =1 -complete =customlist ,s: Findcomplete Vvsplit :execute s: find (<count> ,' vsplit' ,<q-args> ,<bang> 1 )
241
+ command ! - bar - bang -range =1 -nargs =1 -complete =customlist ,s: Findcomplete Vtabedit :execute s: find (<count> ,' tabedit' ,<q-args> ,<bang> 1 )
242
+ command ! - bar - bang -range =1 -nargs =1 -complete =customlist ,s: Findcomplete Vpedit :execute s: find (<count> ,' pedit' ,<q-args> ,<bang> 1 )
243
+ command ! - bar - bang -range =1 -nargs =1 -complete =customlist ,s: Findcomplete Vread :execute s: find (<count> ,' read' ,<q-args> ,<bang> 1 )
232
244
233
245
" vim:set ft = vim ts = 8 sw = 2 sts = 2 :
0 commit comments