Vim - How do I detect that the buffer is loaded in the quickfix window?

4

1

Various plugins that I use load their own results into a buffer in the quickfix window. For example, ack.vim loads it's search results there.

I would like to turn off various things like spell checking and the 80 column line indicator when buffers are loaded into the quickfix window.

How do I detect that the buffer is loaded in the quickfix window?

UPDATE

I have this so far, which turns off the 80 column marker for quickfix windows.

au BufReadPost quickfix setlocal colorcolumn=0

jordelver

Posted 2013-03-12T10:51:08.640

Reputation: 1 781

Answers

7

Vim also sets the 'filetype' to qf for the quickfix buffer. Therefore, you can put your customizations into ~/.vim/after/ftplugin/qf.vim (assuming you have :filetype plugin on), and it will be sourced automatically.

If you need different settings depending on which command (e.g. :make vs :grep) created the quickfix contents, you can alternatively hook into the QuickFixCmdPost event with an :autocmd.

Ingo Karkat

Posted 2013-03-12T10:51:08.640

Reputation: 19 513

Thank you. I ended up going for this: au BufReadPost quickfix setlocal colorcolumn=0 which seems to work great. Thanks :) – jordelver – 2013-03-12T12:00:28.163