Set vim highlight colors

I use :set showmatch to highlight a suitable bracket or brackets when the cursor is over one.

I would like to change the color of the backlight so that it is radically different from the color of the cursor, because I had the situation shown in the screenshots.

When the cursor is over the second curly bracket:
Cursor over the second brace

and when the cursor is directly to the right of the brace:
Cursor to the right

This uses my terminal color scheme, which is taken from Solarized . Unfortunately, it’s a little pain to see which highlight is matching braces, and which is the cursor when braces are close together.

Is there a vim parameter that I can use to change the color of this, say, to bold magenta ANSI? I'm not particularly interested in reassigning my ANSI colors in a terminal or shell. I need a vim specific parameter if one exists.

+43
vim
May 24 '12 at 23:41
source share
3 answers

you can change colors to, for example, blue to green

 hi MatchParen cterm=none ctermbg=green ctermfg=blue 

just put it in your vimrc file.

basically, cterm defines a style that can be none , underline or bold , while ctermbg and ctermfg are, as their names show, the background and foreground colors, so change them as you see fit.

for your case you may want

 hi MatchParen cterm=bold ctermbg=none ctermfg=magenta 
+59
May 24 '12 at 23:53
source share

I am using the vividchalk color scheme with macvim and none of the various solutions I tried worked for me. But I was looking for a file:

 ~/.vim/colors/vividchalk.vim 

for MatchParen , and I found this line:

 call s:hibg("MatchParen","#1100AA","DarkBlue",18) 

I commented on this line, then I copied this line and I changed it to:

  call s:hibg("MatchParen","#FF0000","Red",18) 

which managed to highlight the corresponding parentheses in red, which is much easier to see. Hope this helps someone else.

If you want to go to the opening bracket / pair / bracket as soon as possible when you enter the closing bracket / finger / bracket, adding:

 set showmatch 

to ~ / .vimrc worked for me.

A very convenient trick sets the cursor on a bracket / pair / bracket, and then dials % to go to the corresponding bracket / pair / bracket. This is especially useful when the matching parenthesis / guy / curly brace scrolls from the page. Entering % second time will return to where you came from.

+3
Dec 19 '14 at 20:42 on
source share

Try :!ls $VIMRUNTIME/colors , these are the default color schemes for Vim. Instead of changing the color scheme :colorscheme name find the color scheme that you like and copy the color scheme :!cp $VIMRUNTIME/colors/<name>.vim ~/.vim/colors/new_name.vim edit it and set it using the color scheme command or better add the colorscheme name to the vimrc file. After changing the color file :colorscheme name reloads the Vim colors. This is convenient :vsp vim, edit the color file in one half, check the changes in the other. I used nye17 answer and add hi MatchParen line to my color_file.vim file, this works fine.
References:
Vim Help
How to manage colors
About Termianl colors

+2
Jan 11 '17 at 20:51 on
source share



All Articles