What is the highlight group for the currently selected line in the quickfix window?
The selected line in the quickfix window uses Search
for highlighting. I'd like to continue using yellow for Search
highlighting, but use blue for quickfix selected line.
Add the following to your vimrc if you want Vim to start with no search highlighting: It can be useful to highlight the word under the cursor like *, but without jumping to the next match. Then you can see the search highlights on the current screen, without any scrolling.
For this vim has commands like :grep and :vimgrep, they create a quickfix list with the results of a search. With this command we can take advantage of the built-in search engine that comes with vim.
How to Customize VIM Color Schemes and Syntax Highlighting 1 Customizing Color Schemes in Vim. First, launch the terminal in Ubuntu 20.04. ... 2 Syntax Highlighting in Vim. First, you will need to create a dummy text file with the Vim text editor to try out this method. ... 3 Conclusion. ...
To highlight all search matches, set the following option: With the defaults, setting this option causes all text matching the current search to be highlighted using the Search highlight group, which adds a yellow background to the current highlighting. See :help hl-Search, or type :hi Search to see what color you have it set to.
Ingo Karkat's answer is right. It's indeed hard-coded in vim code. I have created a patch - QuickFixCurrentLine.patch for vim8.
Patch is long enough to be posted here. Plus, it has mix of tabs and spaces. So, providing a link-only-answer.
EDIT:
The patch has got upstreamed in the latest vim code.
The name of the highlight has been changed to quickfixline instead of quickfixcurrentline.
The currently selected quickfix item is hard-coded to Search
. You'd have to change the Vim source code and recompile to change this.
I see only limited ways to work around this with Vimscript. You could try to override the highlighting for the current line via :match
/ matchadd()
(it has higher priority), but it would only cover the length of the text, not the entire line the original highlighting. Also, I think the currently selected item cannot be easily queried from Vim, so you'd have to hook into the quickfix-local <CR>
mapping to update it, and stop using :cnext
etc. to move to different errors.
:highlight BlueLine guibg=Blue
:autocmd BufReadPost quickfix match BlueLine /\%1l/
:autocmd BufReadPost quickfix nnoremap <buffer> <CR> :execute 'match BlueLine /\%' . line('.') . 'l/'<CR><CR>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With