Automatic quickfix/location window

5 Points

Romain Lafourcade Romain Lafourcade

10 years ago

Automatically opens the quickfix/location window after :make, :grep, :lvimgrep and friends when there are errors/locations.

augroup qf
    autocmd!
    autocmd QuickFixCmdPost grep,make,grepadd,vimgrep,vimgrepadd,cscope,cfile,cgetfile,caddfile,helpgrep cwindow
    autocmd QuickFixCmdPost lgrep,lmake,lgrepadd,lvimgrep,lvimgrepadd,lfile,lgetfile,laddfile lwindow
augroup END

Konfekt

Konfekt 10 years ago

How about

autocmd QuickFixCmdPost l* lwindow autocmd QuickFixCmdPost [^l]* cwindow

instead? Also, currently lgrep would trigger both autocmd's because by \| instead of , the patterns are evaluated as regular expressions.

Romain Lafourcade

Romain Lafourcade 10 years ago

@Konfect, no, :lgrep only triggers one of the autocommands, here.

Konfekt

Konfekt 10 years ago

Ok. On my install (Linux, Vim 7.4.580) lmake would trigger both lwindow and cwindow. Using , instead of \| or the above pattern stopped that.

Romain Lafourcade

Romain Lafourcade 10 years ago

@Konfect, I'll take your , advice anyway. Thanks.