Skip to content

Commit d854119

Browse files
committed
Fix gf on render :partial => 'foo/bar.html'
1 parent 90437ed commit d854119

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

autoload/rails.vim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1936,10 +1936,10 @@ function! s:RailsFind()
19361936
let res = s:findasymbol('template','app/views/\1')
19371937
if res != ""|return res|endif
19381938

1939-
let res = s:sub(s:sub(s:findasymbol('partial','\1'),'^/',''),'\k+$','_&')
1939+
let res = s:sub(s:sub(s:findasymbol('partial','\1'),'^/',''),'[^/]+$','_&')
19401940
if res != ""|return res."\n".s:findview(res)|endif
19411941

1942-
let res = s:sub(s:sub(s:findfromview('render\s*(\=\s*\%(:partial\s\+=>\|partial:\)\s*','\1'),'^/',''),'\k+$','_&')
1942+
let res = s:sub(s:sub(s:findfromview('render\s*(\=\s*\%(:partial\s\+=>\|partial:\)\s*','\1'),'^/',''),'[^/]+$','_&')
19431943
if res != ""|return res."\n".s:findview(res)|endif
19441944

19451945
let res = s:findamethod('render\>\s*\%(:\%(template\|action\)\s\+=>\|template:\|action:\)\s*','\1.'.format.'\n\1')
@@ -2044,7 +2044,7 @@ function! s:RailsIncludefind(str,...)
20442044
" Classes should always be in .rb files
20452045
let str .= '.rb'
20462046
elseif line =~# ':partial\s*=>\s*'
2047-
let str = s:sub(str,'([^/]+)$','_\1')
2047+
let str = s:sub(str,'[^/]+$','_&')
20482048
let str = s:findview(str)
20492049
elseif line =~# '\<layout\s*(\=\s*' || line =~# ':layout\s*=>\s*'
20502050
let str = s:findview(s:sub(str,'^/=','layouts/'))

0 commit comments

Comments
 (0)