How do I change the unused background color in vim? - vim

How do you change the unused / bottom portion of the vim editor? The picture will hopefully clarify my terrible description :).

That section is controlled by the highlight group NonText. So you can add the following line after your colorscheme line to set the background color to blue.
highlight NonText ctermbg=blue
Of course change blue to whatever color you want. Also if you are in gvim you will want to use guibg= to set the background color.

Related

Is there a way in vim to change search text highlight color in visual mode only?

(I am using the nord-vim color scheme, but this is an issue with all color schemes in vim that I've tried, and I am looking for what settings need to be changed to accomplish the desired goal)
I have a problem in vim where if I do a search the highlight text color for the search matches is the same as the visual mode background color, so if I search for some text and then visually select some lines of text containing one or more search results, the text disappears. It does so because visual mode is changing the background color but not the text color, which is the desired behavior, except in the one case of search results, which I would like to change the text color of but only in visual mode.
Is this possible in vim?
EXAMPLE:
(do a search for some text, and it is highlighted)
(visually select some lines of text containing search results)
I would like it if the search results changed text color to some other distinguishable color, to indicate that they are search results, but only in visual mode.
It is sadly not documented but it happens so that some highlight groups, like Visual, have some sort of priority over others, like Search:
hi Visual cterm=NONE ctermbg=cyan ctermfg=black
hi Search cterm=NONE ctermbg=yellow ctermfg=black
AFAIK, the only way to explicitly increase the priority of a highlight group is to set its cterm/gui attribute to reverse and swap the *fg and *bg attributes:
hi Visual cterm=NONE ctermbg=cyan ctermfg=black
hi Search cterm=reverse ctermbg=black ctermfg=yellow
But even then, you will notice that it's only the reverse bit that has some effect when interacting with Visual, with the color attributes of Search totally ignored, which may or may not be satisfactory.
This gist explains how best to override highlight groups.

In vim, how do I change the highlight color of the currently highlighted search term?

From Fandom:
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.
hi Search will change the color of matching patterns in vim, but not the currently selected search term, which has an unreadable yellow background. How can I change this currently selected background to something else? What's the hi ### term?
The option is called IncSearch so the line will look something like this:
hi IncSearch cterm=NONE ctermfg=yellow ctermbg=green
It is possible to look at the colorschemes in the $VIMRUNTIME/colors/*.vim files of the machine.

How to change vimtex highlight colors for matching delimiters?

I've installed vimtex and have enabled highlighting of matching delimiters, but it's a bit painful to see the highlighted part. How can I change the highlight color?
This can be changed using the MatchParen highlighting group, for example:
:hi MatchParen ctermbg=5

How to retrieve the current mode color highlight used in the status line?

I'm working on adding an automatic highlight for my current line in Vim, that matches the current mode color used in the status line. So far I haven't had much success if finding a way to get what that current color is.
The colors for the status line are being set based on the current theme, so I'd rather set my current line color dynamically rather than hard coding it.
For example, a few of my mode colors are:
Normal = Blue
Insert = Green
Visual = Red
I'd like to be able to retrieve the exact color codes used for those highlights from the current theme, so that I can set up a few simple autocommands to use them for mode switches.
Is there a way to easily retrieve these colors?
You can query the colors and attributes of a highlight group via synIDattr(); you can find an example at :help hlID().
If you intend to use the cursorline feature and have a single-colored statusline that gets its StatusLine highlight group changed dynamically by autocmds, simply linking both (:hi link CursorLine StatusLine) might already work.
PS: I personally would find it highlight confusing if the same colored line could either represent the current line or one of the horizontal separators between windows, but your mileage obviously varies...

Background color, notepad++ for highlighting purposes

Is there a way in Notepad++ to highlight a snippet of text and change it's background color? I would like it to remain that color within the editor for highlighting purposes. I don't want the color to change the code at all.
You can get the effect you want by right-clicking on the highlighted snippet and selecting "Style token" -> "Using (n)th style".
This will also highlight any other sections of your code which are identical to the one you selected, which may or may not be what you want. However the highlighting will only remain for as long as you have that file open in notepad++. If you close it, you will lose the highlighting.
In Notepad++
First select the line/words to be highlighted
Go to 'Search' Menu
Select 'Mark All'.
There you will find 5 sub-menu as 'using [1..5]th style'.
(using 1st style : cyan colour) .
(2nd : light brown) .
(3rd : yellow) .
(4th : purple) .
(5th : green) .
However the highlighting will only remain for as long as you have that file open in notepad++. If you close it, you will lose the highlighting.
You can also define a language that set the snippet as a keyword and choose style for it.

Resources