4

I'm using Dispatch.vim, and often when there's a test error, some lines in the quickfix list are really long. I don't use soft wrapping for my code, so quickfix also isn't wrapped. Is it possible to automatically setlocal wrap only for the quickfix window?

10

Autocommands to the rescue!

Put these lines in your vimrc:

augroup quickfix
    autocmd!
    autocmd FileType qf setlocal wrap
augroup END

There's also this slightly cleaner method:

  1. create ~/.vim/after/ftplugin/qf.vim,
  2. and put this line in it:

    setlocal wrap
    

The first method adds yet another autocommand to the possibly large pile of autocommands already in your config.

The second method takes advantage of the fact that Vim already runs its own set of autocommands to determine filetype and source the appropriate ftplugins.

| improve this answer | |
  • Perfect! I didn't know that quickfix list has it's own filetype. Thank you! – janko-m Apr 7 '15 at 19:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.