Skip to content

Commit a90ca0a

Browse files
committed
Fix gf bug
1 parent 43f6057 commit a90ca0a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ftplugin/ruby.vim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,14 +302,15 @@ function! s:gf(count,map,edit) abort
302302
if getline('.') =~# '^\s*require_relative\s*\(["'']\).*\1\s*$'
303303
let target = matchstr(getline('.'),'\(["'']\)\zs.\{-\}\ze\1')
304304
return a:edit.' %:h/'.target.'.rb'
305-
elseif getline('.') =~# '^\s*\%(require \|load \|autoload :\w\+,\)\s*\|^\s*require(\=\s*File\.expand_path(\(["'']\)\.\./.*\1,\s*__FILE__)\s*$'
305+
elseif getline('.') =~# '^\s*\%(require[( ]\|load[( ]\|autoload[( ]:\w\+,\)\s*\s*File\.expand_path(\(["'']\)\.\./.*\1,\s*__FILE__)\s*$'
306306
let target = matchstr(getline('.'),'\(["'']\)\.\./\zs.\{-\}\ze\1')
307307
return a:edit.' %:h/'.target.'.rb'
308308
elseif getline('.') =~# '^\s*\%(require \|load \|autoload :\w\+,\)\s*\(["'']\).*\1\s*$'
309309
let target = matchstr(getline('.'),'\(["'']\)\zs.\{-\}\ze\1')
310310
else
311311
let target = expand('<cfile>')
312312
endif
313+
let g:target = target
313314
let found = findfile(target, &path, a:count)
314315
if found ==# ''
315316
return 'norm! '.a:count.a:map

0 commit comments

Comments
 (0)