Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change GVim Color Scheme to be Like Command Line Vim

Tags:

vim

Is it possible to make the color scheme of GVim to exactly match the one in the command line version Vim? I like the colors of Vim more than the white-backgrounded GVim, but I still want to use GVim because the shift key doesn't map well on the command line version.

like image 734
Rafid Avatar asked Nov 04 '10 18:11

Rafid


3 Answers

This gets gvim pretty close to default vim on my green text on black console.

hi clear
set background=dark
if exists("syntax_on")
  syntax reset
endif

hi Normal                 ctermfg=green guifg=green  guibg=black


hi SpecialKey     term=bold ctermfg=4
hi NonText        term=bold cterm=bold ctermfg=4
hi Directory      term=bold ctermfg=4
hi ErrorMsg       term=standout cterm=bold ctermfg=7 ctermbg=1
hi IncSearch      term=reverse cterm=reverse
hi Search         term=reverse ctermfg=0 ctermbg=3
hi MoreMsg        term=bold ctermfg=2
hi ModeMsg        term=bold cterm=bold
hi LineNr         term=underline ctermfg=3
hi Question       term=standout ctermfg=2
hi StatusLine     term=bold,reverse cterm=bold,reverse
hi StatusLineNC   term=reverse cterm=reverse
hi VertSplit      term=reverse cterm=reverse
hi Title          term=bold ctermfg=5
hi Visual         term=reverse cterm=reverse
hi WarningMsg     term=standout ctermfg=1
hi WildMenu       term=standout ctermfg=0 ctermbg=3
hi Folded         term=standout ctermfg=4 ctermbg=7
hi FoldColumn     term=standout ctermfg=4 ctermbg=7
hi DiffAdd        term=bold ctermbg=1
hi DiffChange     term=bold ctermbg=5
hi DiffDelete     term=bold cterm=bold ctermfg=4 ctermbg=6
hi DiffText       term=reverse cterm=bold ctermbg=1
hi SignColumn     term=standout ctermfg=4 ctermbg=7
hi SpellBad       term=reverse ctermbg=1
hi SpellCap       term=reverse ctermbg=4
hi SpellRare      term=reverse ctermbg=5
hi SpellLocal     term=underline ctermbg=6
hi Pmenu          ctermbg=5
hi PmenuSel       ctermbg=7
hi PmenuSbar      ctermbg=7
hi PmenuThumb     cterm=reverse
hi TabLine        term=underline cterm=underline ctermfg=0 ctermbg=7
hi TabLineSel     term=bold cterm=bold
hi TabLineFill    term=reverse cterm=reverse
hi CursorColumn   term=reverse ctermbg=7
hi CursorLine     term=underline cterm=underline gui=underline guibg=black
hi MatchParen     term=reverse ctermbg=6
hi Comment        term=bold ctermfg=4
hi Constant       term=underline ctermfg=1 guifg=red
hi Special        term=bold ctermfg=3
hi Identifier     term=underline ctermfg=6
hi Statement      term=bold ctermfg=3 guifg=darkyellow
hi PreProc        term=underline ctermfg=5 guifg=magenta
hi Type           term=underline ctermfg=2
hi Underlined     term=underline cterm=underline ctermfg=5
hi Ignore         cterm=bold ctermfg=7
hi Error          term=reverse cterm=bold ctermfg=7 ctermbg=1
hi Todo           term=standout ctermfg=0 ctermbg=3
like image 144
AlwaysTraining Avatar answered Nov 20 '22 12:11

AlwaysTraining


:colors koehler or :colors torte will set a not-too-horrible color scheme with a black background. I'm not sure what the command-line colors look like, though, so it may not match what you were looking for.

If you like that, add it to a file named .vimrc or _vimrc in your home directory. Otherwise, it'll change back next time you open gVim.

like image 33
cHao Avatar answered Nov 20 '22 13:11

cHao


Yes, it is possible to make gvim exactly match terminal Vim. (It's not always possible to go the other way, though, gvim allows more colors so you can't always make terminal vim match if you're using gvim as your base.)

Colors are controlled with the ':highlight' command ( http://vimdoc.sourceforge.net/htmldoc/syntax.html#:highlight ) , 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: http://vim.wikia.com/wiki/Xterm256_color_names_for_console_Vim

Note: the ':colorscheme' command fits in with the ':highlight' command by running the commands in a "colorscheme" file found in Vim's '/colors' directory. The colorscheme file itself will be mostly composed of highlight commands that set colors for all the different elements in the colorscheme. It's worth reading the help to see how all this fits together. Also, if you go to the Vim site you will find a bazillion scripts that are devoted to changing your colorscheme. Most of these are geared towards gvim, but many try to be friendly to both gvim and terminal vim. You can start here: http://www.vim.org/scripts/script_search_results.php?keywords=&script_type=color+scheme&order_by=rating&direction=descending&search=search Just find one you like and plop the file in your /colors directory.

Alternatively, take a look at samples here: http://vimcolorschemetest.googlecode.com/svn/html/index-pl.html

like image 10
Herbert Sitz Avatar answered Nov 20 '22 13:11

Herbert Sitz