Make gvim 7.2 background black - vim

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

Related

Where i can get white colorscheme from gVim?

Usually I like to use this theme:
How I can get it in Vim?
Vim's default colorscheme will look just like GVim's if you set your terminal emulator's background to white.

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.

Inverted colors in status line. Why?

I use gvim 7.4 on Windows, clean install, no plugins. Can anybody explain, why this:
highlight statusline guifg=red guibg=green
will show me green text on red background.
But this one:
highlight statusline gui=NONE guifg=red guibg=green
will show red text on green background?
(The actual goal was to change the text in statusline from bold to normal. For this task, I added gui=NONE and then, see this strange behaviour).
Edit
(As my answer to Kent's comment)
Here is my complete _vimrc. There are only two lines on code:
set laststatus=2
highlight statusline gui=NONE guifg=red guibg=green
Also tried:
hi gives the same effect as highlight
StatusLine gives the same effect as statusline
To check how was a hi-group defined, in vim use: hi GroupName, that's why I keep asking OP and Carpetsmoker to provide their cmd output.
After vim has been compiled and installed, some default HL-Groups have been already defined.
From time to time people asked about the default color scheme. And want to extend the "default" color scheme. The location is easy to find, on a linux box, e.g. it locates at /usr/share/vim/vim74/colors/default.vim, different distributions could have different paths.
However if we open the default.vim, we will see a rather simple vim file. No any HL definition. Because they were in vim source codes as default defined.
Regarding the StatusLine group, it was defined in syntax.c file:
https://github.com/vim/vim/blob/8bc189e81aa98ba4aebb03a9dc9527a210fce816/src/syntax.c#L6784
We can see that the reverse is in StatusLine and StatusLineNC groups.
To get rid of the reverse "feature", you have to overwrite the gui or cterm attribute.
This is because the default StatusLine is:
:hi StatusLine
StatusLine xxx term=bold,reverse cterm=bold,reverse gui=bold,reverse
Notice the reverse keyword in cterm and gui? That tells it to use reverse video.
This is also why the colours are what you expect if you use gui=NONE (or gui=bold).
hi gives the same effect as highlight
hi is just the abbreviated version of highlight.

Vim highlighting with solarized color scheme

I have a vim highlight to display whitespace errors in code:
" Highlight redundant whitespaces and tabs.
highlight RedundantSpaces ctermbg=red
match RedundantSpaces /\s\+$\| \+\ze\t\|\t/
Which displays trailing whitespace problems like this:
However, i've recently started using the solarized color scheme and I am not able to get these highlights to display.
I've tried changing the color names to no avail. The relevant part of my (simple) .vimrc says:
syntax enable
set background=dark
colorscheme solarized
Moving the :highlight after the :colorscheme still doesn't help you when you switch colorschemes in the Vim session.
For that to work, re-define your highlighting via the ColorScheme event:
autocmd ColorScheme * highlight RedundantSpaces ctermbg=red
BTW, your minimalistic solution has other problems:
It does not highlight in split windows.
You lose the ability of quickly highlighting custom stuff via :match.
There are several plugins that offer this functionality, in a better way. Mine is called ShowTrailingWhitespace; the plugin page contains links to alternatives.

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 )

Resources