Skip to content

Commit 9db428b

Browse files
committed
Inject default tasks into 'errorformat'
Toying with using this in dispatch.vim. The `%\&` trick prevents a false match, and I've gone ahead and updated the chdir injection to use this as well.
1 parent 3cb73e6 commit 9db428b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

autoload/rails.vim

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,7 +1163,7 @@ endfunction
11631163
" Rake {{{1
11641164

11651165
function! s:qf_pre() abort
1166-
let dir = substitute(matchstr(','.&l:errorformat, ',chdir \zs\%(\\.\|[^,]\)*'), '\\,' ,',', 'g')
1166+
let dir = substitute(matchstr(','.&l:errorformat, ',%\\&chdir \zs\%(\\.\|[^,]\)*'), '\\,' ,',', 'g')
11671167
let cwd = getcwd()
11681168
if !empty(dir) && dir !=# cwd
11691169
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd'
@@ -5428,7 +5428,12 @@ function! rails#buffer_setup() abort
54285428

54295429
compiler rails
54305430
let &l:makeprg = self.app().rake_command('static')
5431-
let &l:errorformat .= ',chdir '.escape(self.app().path(), ',')
5431+
let &l:errorformat .= ',%\&chdir '.escape(self.app().path(), ',')
5432+
if &l:makeprg =~# 'rails$'
5433+
let &l:errorformat .= ',%\&buffer=`=rails#buffer('.self['#'].').default_task(v:lnum)`,%\&default=default'
5434+
elseif &l:makeprg =~# 'rake$'
5435+
let &l:errorformat .= ',%\&buffer=`=rails#buffer('.self['#'].').default_rake_task(v:lnum)`'
5436+
endif
54325437

54335438
if exists(':Dispatch') == 2 && !exists('g:autoloaded_dispatch')
54345439
runtime! autoload/dispatch.vim

0 commit comments

Comments
 (0)