Skip to content

Commit

Permalink
Fall back to Projectionist alternate
Browse files Browse the repository at this point in the history
References #505
  • Loading branch information
tpope committed Jul 9, 2018
1 parent 52f3812 commit 3f82285
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions autoload/rails.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3525,6 +3525,21 @@ function! s:AR(cmd,related,line1,line2,count,...) abort
let file = rails#buffer().alternate(line)
endif
let has_path = !empty(file) && rails#app().has_path(file)
if empty(file) && exists('b:projectionist') && exists('*projectionist#query_file')
try
let expn = line ? {'lnum': line} : {}
let method = rails#buffer().last_method(line)
if len(method)
let expn.define = method
endif
for alt in projectionist#query_file('alternate', expn)
if s:getftime(alt) !=# -1
return s:find(a:cmd, alt)
endif
endfor
catch
endtry
endif
let confirm = &confirm || (histget(':', -1) =~# '\%(^\||\)\s*conf\%[irm]\>')
if confirm && !line && !has_path
let projected = rails#buffer().projected_with_raw('alternate')
Expand Down

0 comments on commit 3f82285

Please sign in to comment.