File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -353,13 +353,14 @@ endfunction
353353
354354function ! RubyCursorFile () abort
355355 let cfile = expand (' <cfile>' )
356+ let ext = getline (' .' ) = ~# ' ^\s*load\>' ? ' ' : ' .rb'
356357 if getline (' .' ) = ~# ' ^\s*require_relative\s*\(["'' ]\).*\1\s*$'
357358 return expand (' %:p:h' ) . ' /' . matchstr (getline (' .' ),' \(["'' ]\)\zs.\{-\}\ze\1' ) . ' .rb'
358- elseif getline (' .' ) = ~# ' ^\s*\%(require[( ]\|load[( ]\|autoload[( ]:\w\+,\)\s*\s*\ %(::\)\=File\.expand_path(\(["'' ]\)\.\./.*\1,\s*__FILE__)\s*$'
359+ elseif getline (' .' ) = ~# ' ^\s*\%(require[( ]\|load[( ]\|autoload[( ]:\w\+,\)\s*\%(::\)\=File\.expand_path(\(["'' ]\)\.\./.*\1,\s*__FILE__)\s*$'
359360 let target = matchstr (getline (' .' ),' \(["'' ]\)\.\./\zs.\{-\}\ze\1' )
360- return expand (' %:p:h' ) . ' /' . target . ' .rb '
361+ return expand (' %:p:h' ) . ' /' . target . ext
361362 elseif getline (' .' ) = ~# ' ^\s*\%(require \|load \|autoload :\w\+,\)\s*\(["'' ]\).*\1\s*$'
362- return matchstr (getline (' .' ),' \(["'' ]\)\zs.\{-\}\ze\1' )
363+ return matchstr (getline (' .' ),' \(["'' ]\)\zs.\{-\}\ze\1' ) . ext
363364 elseif s: synname () == # ' rubyConstant'
364365 let cfile = substitute (cfile ,' \.\w\+$' ,' ' ,' ' )
365366 let cfile = substitute (cfile ,' ::' ,' /' ,' g' )
You can’t perform that action at this time.
0 commit comments