How can I change a part of colour scheme? - vim

Here is my color scheme setting in .vimrc
" Use the Solarized Dark theme
set background=dark
" set background=light
colorscheme solarized
let g:solarized_termtrans=1
It looks like this in Terminal on OSX.
The problem with this scheme is that the cursor is invisible. How can make the cursor visible again?
Similarly in markdown files, for the currently selected line the color scheme is blue on black, which make it rather hard to read. How can i change this?

You can use the Cursor highlight group to recolor the cursor:
:highlight Cursor ctermfg={color} ctermbg={color} cterm={attributes}
To see what values can be placed in the {color} and {attributes} section, read this article in vim:
:help highlight-args

Related

Colorscheme is not changing anything in vim

I'm typing :colorscheme desert or :colorscheme default or any other type of colorscheme in my vim, and I'm just getting the same one colorered text for my code with a black background. I would like the text in my files to have multiple colors to distinguish things but don't know how to do this
Perhaps you could provide your .vimrc and :version.
You may be missing any of these:
syntax on
set t_Co=256
filetype plugin indent on
You can check how the colorscheme is rendered via :hi. If all you see is black and white, Vim probably does not recognize your (color) terminal, and :set t_Co? will output 2 [colors]. Check your $TERM setting then.

How to change the color of the left gutter in VIM?

In VIM, i'm using a default theme from someone else with tweaks. The color on the left
gutter is dark gray and this makes it hard to see the contents of my gutter (in this case it's vim-gitgutter).
Example:
How can I update the .vimrc to change this color?
Thanks
The gutter is called the sign-column in vim. It is controlled by the highlight group SignColumn
Example:
highlight SignColumn guibg=blue ctermbg=white
(This needs to be placed after you source your colorscheme)
This could have been found from the vim-gitgutter readme.
Locate the hi SignColumn in the colorscheme and play with the guibg and ctermbg values.

Set vim bracket highlighting colors

I'm using :set showmatch to highlight the matching bracket or brace when the cursor is over one.
I'd like to change the highlight-color so that it's radically different from the cursor color, because I've got the situation shown in the screenshots.
When the cursor is over the second brace:
and when the cursor is to the immediate-right of the brace:
This uses my terminal color scheme, which is taken from Solarized. Unfortunately, it's a bit of a pain to see which highlight is the brace matching and which is the cursor, when the braces are close together.
Is there a vim setting I can use to change the color of that to, say, the bold magenta ANSI? I'm not particularly interested in remapping my ANSI colors within the terminal or shell - I'd like a vim-specific option, if it exists.
you can change the colors to, e.g., blue over green
hi MatchParen cterm=none ctermbg=green ctermfg=blue
just put it in your vimrc file.
basically, cterm determines the style, which can be none, underline or bold, while ctermbg and ctermfg are, as their names suggest, 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
I'm using the vividchalk color scheme with macvim, and none of the various solutions I tried worked for me. But I searched the file:
~/.vim/colors/vividchalk.vim
for MatchParen and I found this line:
call s:hibg("MatchParen","#1100AA","DarkBlue",18)
I commented out that line, then I copied that line, and I changed it to:
call s:hibg("MatchParen","#FF0000","Red",18)
which succeeded in highlighting the matching parenthesis in red, which is a LOT easier to see. I hope that helps someone else.
If you want to briefly jump to the opening bracket/paren/brace when you type the closing bracket/paren/brace, then adding:
set showmatch
to ~/.vimrc worked for me.
A very handy trick is setting the cursor on a bracket/paren/brace and then typing % to jump to the matching bracket/paren/brace. That is especially useful when the matching bracket/paren/brace has scrolled off the page. Typing % a second time will jump back to where you came from.
Try :!ls $VIMRUNTIME/colors these are default color schemes Vim supply. Than change color scheme :colorscheme name find color scheme that You like and copy color scheme :!cp $VIMRUNTIME/colors/<name>.vim ~/.vim/colors/new_name.vim edit it and set with color scheme command or better add colorscheme name to vimrc file. After changes to color file :colorscheme name reloads Vim's colors. It's handy :vsp vim, edit colors file in one half, check changes in other. I used nye17 answer and add hi MatchParen line to my color_file.vim it work's just fine.
Links:
Vim help
How to control colors
About Termianl colors
The colours that I use for vim highlighting, (from my ~/.vimrc):
" set sensible highlight matches that don't obscure the text
:highlight MatchParen cterm=underline ctermbg=black ctermfg=NONE
:highlight MatchParen gui=underline guibg=black guifg=NONE
NONE uses the character colour from the
:colourscheme ron (or which ever you prefer from :!ls $VIMRUNTIME/colors )

How do you change the background color of the empty tab space in vim?

In vim, when you create a new tab, the tab bar appears at the top of the screen. On the left are all your tabs, on the far right is an "X" for closing the tabs. In between, there is "empty" space, that on my screen appears white.
I'll admit, I'm very picky about how my terminal looks, and this bright white bar at the top of the screen is distracting. Is it possible to change this color to black, or maybe even gray?
TLDR;
For a black tab bar (color 0)
:hi TabLineFill term=bold cterm=bold ctermbg=0
Explanation
Use vim's highlight command to set the attributes you want on the TabLineFill group.
This command will show you a list of all the current groups and their highlight attributes.
:hi
Find TabLineFill, and next to it you will see a preview of how your "tab line" will appear. Also note the attributes on this line.
In order for the color you want to be displayed, the attribute representing your terminal needs to be set to "bold". The two options are "term" and "cterm". If your using vim in a color terminal, then cterm will apply, otherwise term will apply. Set these attributes to bold like this:
:hi TabLineFill term=bold cterm=bold
The attribute "ctermbg" may or may not appear on the TabLineFill line, but it is used to define the color of the terminal background. See the list of cterm-color options by typing:
:help cterm-colors
Choose a color (for unobtrusive, I recommend 0, which is Black), then set the ctermbg attribute to the code for that color:
:hi TabLineFill ctermbg=0
This can all be combined into one single command:
:hi TabLineFill term=bold cterm=bold ctermbg=0
Try the following: (you can put that in your .vimrc)
:hi TabLineFill ctermbg=100
you can play with the colors and choose one that you like.
If you came here looking to change colours of the tab character, you want this:
:highlight SpecialKey guifg=<color> ctermfg=<color>
Since this is the first google result for "vim tab background color":
TabLineFill's ctermbg doesn't do anything for me. Set ctermfg=N where N is the desired background color. Don't set ctermbg, and definitely don't set ctermbg=ctermfg as this creates a white background.
That color is controlled by the current colorscheme. You can use :colorscheme to change schemes and find one you like (that has a better color for that area). You can see some sample schemes here (albeit without a tab bar shown).
vi, set the background color of tabs:
Manually in vim at the vim command terminal:
:syn match Tab "\t"
:hi def Tab ctermbg=darkgreen guibg=#003000
I used the following commands in the vim syntax file to make the changes permanent: (they didn't work in the ~/.vimrc nor the colors/monokai.vim colorscheme files)
syn match Tab "\t"
hi def Tab ctermbg=darkgreen guibg=#003000
I got these results:
Alternatively, There is a syntax highlighting scheme called: "whitespace.vim" that manipulates these background colors. It should just work and you can see it in action by using the command:
:set syntax=whitespace
It has custom colors for the various types of whitespace, you can follow that and see how it works to copy it.

Make gvim 7.2 background black

I am sick and tired of the white background when I edit C/C++ etc. I want the black backround. That is what I currently have in my .vimrc file in regard to coloring. Please help me change it:
if !has('gui_running')
set t_Co=8 t_md=
highlight NORMAL ctermbg=black ctermfg=white
:help colorscheme
For example:
:colorscheme torte
Or, find a color scheme you like at vim.org.
Colors are controlled with the :highlight command Vim documentation: syntax , which allows you to specify colors for gvim (guifg and guibg) differently from colors for terminal vim (ctermfg and ctermbg).
All you have to do is make sure that the colors you assign to guifg and guibg are the same as you assign to ctermfg and ctermbg. Here's a script that might get you going: Xterm256 color names for console Vim
Depending on your colorscheme, the following command might work (it does depend on the colorscheme).
:set background=dark

Resources