Wednesday, September 4, 2013

Re: Set different highlighting for Search versus current quickfix error

On 05/09/13 02:33, Paul wrote:
> On Wednesday, September 4, 2013 7:47:25 PM UTC-4, Tony Mechelynck wrote:
>> ...if I do :copen first...I see this item as blue on white, and
>> doing ":verbose hi qfFileName" in the quickfix window gives
>>
>> qfFileName xxx links to Directory
>> Last set from /usr/local/share/vim/vim74/syntax/qf.vim
>>
>> The Search highlight, OTOH, is black on yellow. Not at all the same
>> thing for me, which makes me ask: Which colorscheme are you using?
>>
>> To link qfFileName to something else, or to define specific colours
>> for it, just use a new or modified colorscheme.
>>
>> To modify a colorscheme, first copy it to ~/.vim/colors/ (for *x
>> systems) or to ~/vimfiles/colors (for Windows), change its name, and
>> modify it there (including setting g:colors_name to the new name);
>> then alter the calling line so that it calls the new name. It is not
>> possible to invoke colorschemes recursively (or at least, I tried
>> and didn't succeed).
>
> I have a colorscheme called mine.vim containing lots of highlight commands. Prepended to those commands is the preamble
>
> set background=dark
> hi clear
> if exists("syntax_on")
> syntax reset
> endif
> let g:colors_name = "mine"
>
> I've actually set g:colors_name to "mine" in the course of trying to figure out how it works. It was "blue" before, probably because I never figured out how it worked, and "blue" was a good fallback colorscheme. Reading the help on colors_name and experimenting, it seems that g:colors_name is only used to get back the colorscheme if you haven't toggled the background setting. If you have, g:colors_name is wiped out.
>
> In any case, none of the :hi statements in mine.vim contain the word "Directory", so I added to following to turn on a bit of green:
>
> hi Directory guibg=#00cc00
>
> All this did was to highlight the filename field of all quickfix entries with a green background. The current quickfix item, however, is still highlighted in the Search guibg (red). This means the entire row, not just a single field in the row.
>
> Based on my last post, I suspect that this is hard-coded.
>
> Thanks for tinkering and posting. I think I have a better idea of how color schemes work now.
>
Ah, yes. Now by setting 'nocul' or by moving the cursor to a different
line of the quickfix window (which I normally don't use: :cnext :cprev
:cnfile :cpfile :cfirst :clast are normally enough for me), I see the
yellow background on the whole line. Let's see...

If I do
:hi Search guibg=pink
the whole line gets a pink background. Now let's try to find if there
are any other highlights which link to Search... No there isn't, so yes,
it must be hardcoded.

But you can hide it (as long as the cursor remains on the line) by
setting 'cursorline'. The CursorLine highlight will then override the
Search highlight for the current quickfix line as long as the cursor
remains on it.


Best regards,
Tony.
--
George, after tying on a whopper the night before, woke up in the morning to
find a pathetically unattractive woman sleeping blissfully beside him. He
leaped out of bed, dressed quickly, and furtively placed $100 on top of the
bureau. He then started to tiptoe out of the room. But, as he passed the
foot of the bed, he felt a tug at his trouser leg. Glancing down, he saw
another female even homelier than the one he'd left in bed. She gazed up
at him soulfully, and asked, "Nothing for the bridesmaid?"

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment