@@ -1860,7 +1860,7 @@ function! s:findamethod(func,repl)
18601860endfunction
18611861
18621862function ! s: findasymbol (sym,repl)
1863- return s: findit (' \s*:\%(' .a: sym .' \)\s*=>\s*(\=\s*[@:' ." '" .' "]\(\f\+\)\>.\=' ,a: repl )
1863+ return s: findit (' \s*\%( :\%(' .a: sym .' \)\s*=>\|\< ' . a: sym . ' :\) \s*(\=\s*[@:' ." '" .' "]\(\f\+\)\>.\=' ,a: repl )
18641864endfunction
18651865
18661866function ! s: findfromview (func ,repl)
@@ -1915,10 +1915,10 @@ function! s:RailsFind()
19151915 let res = s: findasymbol (' to' ,' app/controllers/\1' )
19161916 if res = ~ ' #' |return s: sub (res ,' #' ,' _controller.rb#' )|endif
19171917
1918- let res = s: findamethod (' root\s*:to\s*=>\s*' ,' app/controllers/\1' )
1918+ let res = s: findamethod (' root\s*\%( :to\s*=>\|\<to:\) \s*' ,' app/controllers/\1' )
19191919 if res = ~ ' #' |return s: sub (res ,' #' ,' _controller.rb#' )|endif
19201920
1921- let res = s: findamethod (' \%(match\|get\|put\|post\|delete\|redirect\)\s*(\=\s*[:'' "][^'' "]*['' "]\=\s*\%(,\s*:to\s*\)\==>\s*' ,' app/controllers/\1' )
1921+ let res = s: findamethod (' \%(match\|get\|put\|post\|delete\|redirect\)\s*(\=\s*[:'' "][^'' "]*['' "]\=\s*\%(\%( ,\s*:to\s*\)\==>\|,\s*to:\) \s*' ,' app/controllers/\1' )
19221922 if res = ~ ' #' |return s: sub (res ,' #' ,' _controller.rb#' )|endif
19231923
19241924 let res = s: findamethod (' layout' ,' \=s:findlayout(submatch(1))' )
@@ -1942,17 +1942,17 @@ function! s:RailsFind()
19421942 let res = s: sub (s: sub (s: findasymbol (' partial' ,' \1' ),' ^/' ,' ' ),' \k+$' ,' _&' )
19431943 if res != " " |return res ." \n " .s: findview (res )|endif
19441944
1945- let res = s: sub (s: sub (s: findfromview (' render\s*(\=\s*:partial\s\+=>\s*' ,' \1' ),' ^/' ,' ' ),' \k+$' ,' _&' )
1945+ let res = s: sub (s: sub (s: findfromview (' render\s*(\=\s*\%( :partial\s\+=>\|partial:\) \s*' ,' \1' ),' ^/' ,' ' ),' \k+$' ,' _&' )
19461946 if res != " " |return res ." \n " .s: findview (res )|endif
19471947
1948- let res = s: findamethod (' render\s* :\%(template\|action\)\s\+=>\s*' ,' \1.' .format.' \n\1' )
1948+ let res = s: findamethod (' render\>\s*\%( :\%(template\|action\)\s\+=>\|template:\|action:\) \s*' ,' \1.' .format.' \n\1' )
19491949 if res != " " |return res |endif
19501950
19511951 let res = s: sub (s: findfromview (' render' ,' \1' ),' ^/' ,' ' )
19521952 if buffer .type_name (' view' ) | let res = s: sub (res ,' [^/]+$' ,' _&' ) | endif
19531953 if res != " " |return res ." \n " .s: findview (res )|endif
19541954
1955- let res = s: findamethod (' redirect_to\s*(\=\s*:action\s\+=>\s*' ,' \1' )
1955+ let res = s: findamethod (' redirect_to\s*(\=\s*\%\( :action\s\+=>\|\<action:\) \s*' ,' \1' )
19561956 if res != " " |return res |endif
19571957
19581958 let res = s: findfromview (' stylesheet_link_tag' ,' public/stylesheets/\1' )
0 commit comments