How to change vimtex highlight colors for matching delimiters? - vim

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

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 do I change the unused background color in 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.

How to change the highlight style in Vim spellcheck?

Right now, when I do :set spell in my Vim, I get spelling errors highlighted as if they are selected text. What I want is an MS-Word like underlining of spelling errors. I tried to lookup :help spell but could not find a clue. Any help is appreciated.
Spelling errors are highlighted using the SpellBad highlighting group. To get it highlighted as you want, you should put something like
hi clear SpellBad
hi SpellBad cterm=underline
" Set style for gVim
hi SpellBad gui=undercurl
after the last line that is altering the color scheme in your vimrc (it is either set background=(dark|light) or colorscheme {schemename}).
See also :h hl-SpellBad for names and descriptions of other Spell* highlight groups.
The above needs to be typed everytime you set colorscheme. If you wish to avoid it, you should use autocmd.
See https://vi.stackexchange.com/questions/18295/how-to-set-a-colorscheme-that-still-shows-spelling-errors
For a quick and dirty way to change the highlighting color if you have a colorscheme loaded, is to modify your colorscheme.
Running, :verbose highlight SpellBad showed me where the config file is for my theme. More like, it showed where the SpellBad directive was set. Your mileage may vary. Please see below output:
:verbose highlight SpellBad
SpellBad xxx term=reverse ctermbg=9 gui=undercurl guisp=Red
Last set from /usr/share/vim/vim81/colors/desert.vim line 17
I navigated to desert.vim and added, hi SpellBad term=reverse ctermbg=226 gui=undercurl guisp=Yellow1 and saved the file. (you'll need sudo to modify the file). Once I reopened vim and ran, :verbose highlight SpellBad the output was now:
:verbose highlight SpellBad
SpellBad xxx term=reverse ctermbg=226 gui=undercurl guisp=Yellow1
Last set from /usr/share/vim/vim81/colors/desert.vim line 35
My highlight color was changed! Note that if you change your colorscheme, you'll most likely have to change the highlight color in your selected colorscheme file.

How to correctly highlight cursor line in VIM?

VIM can be configured to highlight current line via :hi cursorline guibg=green and set cursorline commands. But if I enable tabs display via:
:hi specialkey guifg=grey guibg=grey
:set listchars="tab"
:set list
Cursor line highlight will corrupt tabs display:
alt text http://dl.dropbox.com/u/239055/vim_cursorline_bug.png
Any hints how i can avoid corruption so may tabs are highlighted with one color and cursor line is highlighted with another color without any ^I displayed at intersection?
Try setting listchars without the quotes:
:set listchars=tab:>-
This shows the tab as >------- instead of ^I, which I think is what you were asking. When the cursor is on the line with the tab, the whole line is displayed in the cursorline colour.
It appears that the cursorline colour takes precedence over the specialkey colour, which is consistent with your screenshot.

Resources