@@ -2069,29 +2069,6 @@ function! s:jump(def, ...) abort
20692069 return ' '
20702070endfunction
20712071
2072- function ! s: Find (count ,cmd,... )
2073- let cmd = (a: count== 1 ?' ' : a: count ) . a: cmd
2074- if a: 0
2075- let i = 1
2076- while i < a: 0
2077- let cmd .= ' ' . s: escarg (a: {i })
2078- let i += 1
2079- endwhile
2080- let file = a: {i }
2081- let tail = matchstr (file ,' [#!].*$\|:\d*\%(:in\>.*\)\=$' )
2082- if tail != " "
2083- let file = s: sub (file ,' [#!].*$|:\d*%(:in>.*)=$' ,' ' )
2084- endif
2085- if file != " "
2086- let file = s: RailsIncludefind (file )
2087- endif
2088- else
2089- let file = s: cfile ()
2090- let tail = " "
2091- endif
2092- return s: find (cmd, file . tail)
2093- endfunction
2094-
20952072function ! s: fuzzyglob (arg)
20962073 return s: gsub (s: gsub (a: arg ,' [^/.]' ,' [&]*' ),' %(/|^)\.@!|\.' ,' &*' )
20972074endfunction
@@ -3192,18 +3169,26 @@ endfunction
31923169
31933170function ! s: Alternate (cmd,line1,line2,count ,... ) abort
31943171 if a: 0
3195- if a: 1 = ~# ' ^#\h'
3196- return s: jump (a: 1 [1 :-1 ], s: sub (a: cmd , ' D' , ' E' ))
3172+ let cmd = ' '
3173+ let i = 1
3174+ while i < a: 0
3175+ let cmd .= ' ' . s: escarg (a: {i })
3176+ let i += 1
3177+ endwhile
3178+ let file = a: {i }
3179+ if file = ~# ' ^#\h'
3180+ return s: jump (file [1 :-1 ], s: sub (a: cmd , ' D' , ' E' ))
31973181 elseif a: count && a: cmd !~# ' D'
3198- return call (' s:Find' ,[1 ,a: line1 .a: cmd ]+ a: 000 )
3182+ let tail = matchstr (file ,' [#!].*$\|:\d*\%(:in\>.*\)\=$' )
3183+ if tail != " "
3184+ let file = s: sub (file ,' [#!].*$|:\d*%(:in>.*)=$' ,' ' )
3185+ endif
3186+ if file != " "
3187+ let file = s: RailsIncludefind (file )
3188+ endif
3189+ return s: find (a: cmd . cmd, file . tail)
31993190 else
3200- let cmd = s: editcmdfor ((a: count ? a: count : ' ' ).a: cmd )
3201- let i = 1
3202- while i < a: 0
3203- let cmd .= ' ' . s: escarg (a: {i })
3204- let i += 1
3205- endwhile
3206- let file = a: {i }
3191+ let cmd = s: editcmdfor ((a: count ? a: count : ' ' ).a: cmd ) . cmd
32073192 return s: edit (cmd, file )
32083193 endif
32093194 elseif a: cmd = ~# ' D'
0 commit comments