I want the cursor line in the quickfix window to be more distinguishable, than in other windows.

Initially I thought that there has to be some different highlight group, it seemly turned out to be false.

Then I had an idea to set the cursorline highlight on a per syntax basis, I added the qf.vim file to the after/syntax directory with a corresponding setting. But when I opened the quickfix window the cursor line changed its background not only in the quickfix but in all other windows too.

Then I tried to use the Search highlight group (the docs :help hl-Search say that this group is used for highlighting the search matches and the current line in the quickfix window). But it didn't work, the current line (cursor line) has remained the same, though the Search was enabled correctly (I checked it with the :hi command and when I tried to search for a pattern it highlighted all matches in the current window as well as the quickfix one, but not the whole current line in the quickfix.

Is there a way to do this, without changing the source and compiling Vim myself?

Thank you.


Patch 8.0.0641 introduced a separate highlight group for the quickfix line, called QuickFixLine. With patch 8.0.0653 this group is linked to the Search highlight by default, because for some color schemes the colors chosen for patch 8.0.0641 did not work well.

So if you have a current version of Vim you can use

hi QuickFixLine cterm=None ctermbg=256 guibg=#ffff00

to make the current line in the quickfix window more distinguishable.

  • thank you for the suggestion, the only problem is that still doesn't eliminate the need to use a separate syntax file for qf, since I still need to disable the cursor line in the quickfix window. – user907860 Jun 28 '17 at 15:26

currently I solved it this way (though I would be very grateful if someone suggested a better way).

I created a syntax highlihgt file for the qf syntax ~/.vim/after/syntax/qf.vim. There I defined:

setlocal nocursorline
hi Search cterm=none ctermbg=226 guibg=#ffff00

This disabled the cursor line highlighting in the quickfix window (which is tolerable for me), and set the search match highlighting only in that window, which is perfect for me.

Now pressing :cn etc. from the main window I am able to see quickly, what an error message I'm currently on.

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.