Skip to content

Commit

Permalink
Support require_relative in gf
Browse files Browse the repository at this point in the history
  • Loading branch information
tpope committed Aug 26, 2011
1 parent b914aed commit 1320b9a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ftplugin/ruby.vim
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,12 @@ endfunction

function! s:gf(count,map,edit) abort
let target = expand('<cfile>')
if target ==# 'require_relative' && getline('.') =~# '^\s*require_relative\s*\(["'']\).*\1'
let target = matchstr(getline('.'),'\(["'']\)\zs.\{-\}\ze\1')
return a:edit.' %:h/'.target.'.rb'
endif
if target =~# '^\%(require\|load\|autoload\)$' && getline('.') =~# '^\s*\%(require \|load \|autoload :\w\+,\)\s*\(["'']\).*\1'
let target = matchstr(getline('.'),'\(["'']\)\zs.\{-\}\ze\1')
let g:target = target
endif
let found = findfile(target, &path, a:count)
if found ==# ''
Expand Down

0 comments on commit 1320b9a

Please sign in to comment.