Skip to content

Commit 3f82285

Browse files
committed
Fall back to Projectionist alternate
References tpope#505
1 parent 52f3812 commit 3f82285

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

autoload/rails.vim

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3525,6 +3525,21 @@ function! s:AR(cmd,related,line1,line2,count,...) abort
35253525
let file = rails#buffer().alternate(line)
35263526
endif
35273527
let has_path = !empty(file) && rails#app().has_path(file)
3528+
if empty(file) && exists('b:projectionist') && exists('*projectionist#query_file')
3529+
try
3530+
let expn = line ? {'lnum': line} : {}
3531+
let method = rails#buffer().last_method(line)
3532+
if len(method)
3533+
let expn.define = method
3534+
endif
3535+
for alt in projectionist#query_file('alternate', expn)
3536+
if s:getftime(alt) !=# -1
3537+
return s:find(a:cmd, alt)
3538+
endif
3539+
endfor
3540+
catch
3541+
endtry
3542+
endif
35283543
let confirm = &confirm || (histget(':', -1) =~# '\%(^\||\)\s*conf\%[irm]\>')
35293544
if confirm && !line && !has_path
35303545
let projected = rails#buffer().projected_with_raw('alternate')

0 commit comments

Comments
 (0)