@@ -67,7 +67,7 @@ if !exists('g:ruby_version_paths')
6767 let g: ruby_version_paths = {}
6868endif
6969
70- function ! s: query_path (root)
70+ function ! s: query_path (root) abort
7171 let code = " print $:.join %q{,}"
7272 if &shell = ~# ' sh'
7373 let prefix = ' env PATH=' .shellescape ($PATH ).' '
@@ -92,7 +92,7 @@ function! s:query_path(root)
9292 endtry
9393endfunction
9494
95- function ! s: build_path (path )
95+ function ! s: build_path (path ) abort
9696 let path = join (map (copy (a: path ), ' v:val ==# "." ? "" : v:val' ), ' ,' )
9797 if &g: path !~# ' \v^\.%(,/%(usr|emx)/include)=,,$'
9898 let path = substitute (&g: path ,' ,,$' ,' ,' ,' ' ) . ' ,' . path
@@ -232,7 +232,7 @@ if exists("g:did_ruby_ftplugin_functions")
232232endif
233233let g: did_ruby_ftplugin_functions = 1
234234
235- function ! RubyBalloonexpr ()
235+ function ! RubyBalloonexpr () abort
236236 if ! exists (' s:ri_found' )
237237 let s: ri_found = executable (' ri' )
238238 endif
@@ -281,7 +281,7 @@ function! RubyBalloonexpr()
281281 endif
282282endfunction
283283
284- function ! s: searchsyn (pattern,syn ,flags,mode )
284+ function ! s: searchsyn (pattern, syn , flags, mode ) abort
285285 let cnt = v: count1
286286 norm! m '
287287 if a: mode == # ' v'
@@ -303,11 +303,11 @@ function! s:searchsyn(pattern,syn,flags,mode)
303303 endwhile
304304endfunction
305305
306- function ! s: synname ()
306+ function ! s: synname () abort
307307 return synIDattr (synID (line (' .' ),col (' .' ),0 ),' name' )
308308endfunction
309309
310- function ! s: wrap_i (back,forward)
310+ function ! s: wrap_i (back,forward) abort
311311 execute ' norm k' .a: forward
312312 let line = line (' .' )
313313 execute ' norm ' .a: back
@@ -317,7 +317,7 @@ function! s:wrap_i(back,forward)
317317 execute ' norm jV' .a: forward .' k'
318318endfunction
319319
320- function ! s: wrap_a (back,forward)
320+ function ! s: wrap_a (back,forward) abort
321321 execute ' norm ' .a: forward
322322 if line (' .' ) < line (' $' ) && getline (line (' .' )+ 1 ) == # ' '
323323 let after = 1
@@ -372,15 +372,19 @@ function! RubyCursorFile() abort
372372 let target = matchstr (getline (' .' ),' \(["'' ]\)\.\.\zs/.\{-\}\ze\1' )
373373 let cfile = expand (' %:p:h' ) . target . ext
374374 elseif getline (' .' ) = ~# ' ^\s*\%(require \|load \|autoload :\w\+,\)\s*\(["'' ]\).*\1\s*$'
375- return fnameescape ( matchstr (getline (' .' ),' \(["'' ]\)\zs.\{-\}\ze\1' ) . ext)
375+ let cfile = matchstr (getline (' .' ),' \(["'' ]\)\zs.\{-\}\ze\1' ) . ext
376376 elseif pre .post = ~# ' \<File.expand_path[( ].*['' "]\{2\}, *__FILE__\>' && cfile = ~# ' ^\.\.'
377377 let cfile = expand (' %:p:h' ) . strpart (cfile , 2 )
378378 else
379379 return substitute (cfile , ' \C\v^(.*):(\d+)%(:in)=$' , ' +\2 \1' , ' ' )
380380 endif
381381 let cwdpat = ' ^\M' . substitute (getcwd (), ' [\/]' , ' \\[\\/]' , ' g' ).' \ze\[\/]'
382382 let cfile = substitute (cfile , cwdpat, ' .' , ' ' )
383- return fnameescape (cfile )
383+ if fnameescape (cfile ) !=# cfile
384+ return ' + ' .fnameescape (cfile )
385+ else
386+ return cfile
387+ endif
384388endfunction
385389
386390"
0 commit comments