I'm disappointed because of the vim behaviour under Ubuntu 13.04 and the issues I'm having the color reproduction.
I have problems when setting a colorscheme and I also tried to fix this issue with set t_Co=256
but I can do anything and nothing changes. I also tried different terminal emulators a and different settings but really nothing changes.
I tried Gvim and apparently it handles the colors correctly nd I have a much more consistent behaviour, now my question is: what am I missing when using gvim instead of vim?
I'm a new vim user so I don't know the potential of these two applications.
EDIT:
For example this is how the darkblue
theme looks like under vim
running in gnome-terminal
Assuming your Ubuntu environment is correctly set up (and judging from the screenshot, it is), you're probably just disappointed that most colorschemes don't come with high color support in the terminal.
You can use the CSApprox plugin (or one of its alternatives) to translate a GUI colorscheme to a high-color (i.e. 88-256 color) terminal. That will get you a closer approximation.
The vanilla colorschemes can't make assumptions about the number of colors, so they are conservative and expect only the 16 basic colors of the PC era.
Setting up color for vim in 256 color XTerm is a bit more involved, but the result is pleasing. Here's what I use. Be sure that your XTerm is actually a 256 color version (it is by default on Ubuntu). This setup will make both vim and gvim use the same colors.
As a bonus, if you have configured your XTerm to use TrueType fonts, it can render highlight as italic--see the white comments (if the font supports it; I use *faceName: Droid Sans Mono
).
" If the xterm supports 256 colors, make sure TERM=xterm-256color.
" If it supports 256 colors but sets TERM=xterm, edit the appropriate
" resource file (~/.Xdefaults or $XAPPLRESDIR/XTerm) and add
" *termName: xterm-256color
" For mintty, select the xterm-256color TERM value in the options menu.
if &term == "xterm-256color"
" Also for Cygwin's mintty.
set t_Co=256
elseif $PROFILE_OS == "Solaris"
set t_Co=256
elseif (&term == "xterm" || &term =~ "cons") && $TTY =~ "/dev/ttyv"
" Adjust for FreeBSD syscons with ANSI colors.
set t_Co=16
map <Esc>[2~ i
map <Esc>[3~ x
map <Esc>[5~ <C-B>
map <Esc>[6~ <C-F>
colorscheme delek
elseif &term == "cygwin"
" Adjust for Cygwin in a cmd.exe window.
set t_Co=16
colorscheme koehler
endif
"
" The cterm color numbers refer to XTerm colors in 256 color mode.
" Map rgb to cterm colors using <URL:https://gist.github.com/719710>.
" cterm=underline is rendered as italic with xterm +ulit
" gui=NONE turns off bold, italic.
"
" Normal must be set before colors "fg" and "bg" can be used.
highlight Normal ctermfg=216 ctermbg=233 guifg=#ffaf87 guibg=#121212
" pink C 'c'
highlight Character
\ cterm=NONE ctermfg=211 ctermbg=bg
\ gui=NONE guifg=#ff87af guibg=bg
" gray This comment.
highlight Comment
\ cterm=underline ctermfg=250 ctermbg=bg
\ gui=italic guifg=#bcbcbc guibg=bg
highlight ColorColumn cterm=NONE ctermfg=7 ctermbg=99 gui=NONE guifg=#c0c0c0 guibg=#875fff
" blue if/then/else/fi.
highlight Conditional
\ cterm=NONE ctermfg=27 ctermbg=bg
\ gui=NONE guifg=#005fff guibg=bg
" lightgreen Numbers and quoted strings.
highlight Constant
\ cterm=NONE ctermfg=82 ctermbg=bg
\ gui=NONE guifg=#5fff00 guibg=bg
highlight Cursor
\ cterm=NONE ctermfg=black ctermbg=red
\ gui=NONE guifg=black guibg=red
highlight CursorColumn cterm=NONE ctermfg=7 ctermbg=97 gui=NONE guifg=#c0c0c0 guibg=#875faf
highlight DiffAdd cterm=NONE ctermfg=8 ctermbg=24 gui=NONE guifg=#808080 guibg=#005f5f
highlight DiffChange cterm=NONE ctermfg=8 ctermbg=56 gui=NONE guifg=#808080 guibg=#5f00d7
highlight DiffDelete cterm=NONE ctermfg=8 ctermbg=88 gui=NONE guifg=#808080 guibg=#870000
highlight DiffText cterm=NONE ctermfg=8 ctermbg=90 gui=NONE guifg=#808080 guibg=#870087
" Status line.
highlight Error
\ cterm=NONE ctermfg=196 ctermbg=234
\ gui=NONE guifg=#ff0000 guibg=black
highlight ErrorMsg
\ cterm=NONE ctermfg=172 ctermbg=black
\ gui=NONE guifg=orange guibg=black
highlight Folded
\ cterm=NONE ctermfg=112 ctermbg=235
\ gui=NONE guifg=#87d700 guibg=#262626
highlight FoldColumn
\ cterm=NONE ctermfg=112 ctermbg=235
\ gui=NONE guifg=#87d700 guibg=#262626
" green Function names (has()).
highlight Function
\ cterm=NONE ctermfg=46 ctermbg=bg
\ gui=NONE guifg=#00ff00 guibg=bg
" lightyellow Names.
highlight Identifier
\ cterm=NONE ctermfg=139 ctermbg=bg
\ gui=NONE guifg=#af87af guibg=bg
highlight Include
\ cterm=NONE ctermfg=50 ctermbg=bg
\ gui=NONE guifg=#00ffd7 guibg=bg
highlight LineNr
\ cterm=underline ctermfg=244 ctermbg=237
\ gui=italic guifg=#808080 guibg=#3a3a3a
highlight Macro
\ cterm=NONE ctermfg=203 ctermbg=bg
\ gui=NONE guifg=#ff5f5f guibg=bg
" --More--
highlight MoreMsg
\ cterm=NONE ctermfg=123 ctermbg=238
\ gui=NONE guifg=#87ffff guibg=#444444
" --INSERT--
highlight ModeMsg
\ cterm=NONE ctermfg=123 ctermbg=238
\ gui=NONE guifg=#87ffff guibg=#444444
" Tilde and @ at the end of the window.
highlight NonText
\ cterm=bold ctermfg=cyan ctermbg=bg
\ gui=bold guifg=cyan guibg=bg
highlight Operator
\ cterm=NONE ctermfg=129 ctermbg=bg
\ gui=NONE guifg=#af00ff guibg=bg
highlight PmenuSbar cterm=NONE ctermfg=fg ctermbg=32 gui=NONE guifg=fg guibg=#0087d7
" medium blue #if/#else/#endif ${foo}
highlight PreProc
\ cterm=NONE ctermfg=75 ctermbg=bg
\ gui=NONE guifg=#5fafff guibg=bg
" Hit-enter and yes/no questions.
highlight Question
\ cterm=NONE ctermfg=green ctermbg=bg
\ gui=NONE guifg=green guibg=bg
highlight Search
\ cterm=NONE ctermfg=153 ctermbg=237
\ gui=NONE guifg=cyan guibg=gray10
" violett <F11>, printf %s, `cmd`
highlight Special
\ cterm=bold ctermfg=125 ctermbg=bg
\ gui=bold guifg=#af005f guibg=bg
" violett <F11> in map
highlight SpecialKey
\ cterm=NONE ctermfg=135 ctermbg=bg
\ gui=NONE guifg=#af5fff guibg=bg
highlight SpellBad
\ cterm=NONE ctermfg=88 ctermbg=140
\ gui=NONE guifg=#870000 guibg=#af87d7
highlight SpellCap
\ cterm=NONE ctermfg=88 ctermbg=138
\ gui=NONE guifg=#870000 guibg=#af8787
highlight SpellLocal
\ cterm=NONE ctermfg=118 ctermbg=236
\ gui=NONE guifg=#87ff00 guibg=#303030
highlight SpellRare
\ cterm=NONE ctermfg=19 ctermbg=75
\ gui=NONE guifg=#0000af guibg=#5fafff
" lightblue Keywords (highlight).
highlight Statement
\ cterm=NONE ctermfg=44 ctermbg=bg
\ gui=NONE guifg=#00d7d7 guibg=bg
highlight StatusLine
\ cterm=bold ctermfg=41 ctermbg=239
\ gui=bold guifg=#00d75f guibg=#4e4e4e
highlight StatusLineNC
\ cterm=NONE ctermfg=245 ctermbg=239
\ gui=NONE guifg=#8a8a8a guibg=#4e4e4e
" olive static, const, volatile
highlight StorageClass
\ cterm=NONE ctermfg=98 ctermbg=bg
\ gui=NONE guifg=#875fd7 guibg=bg
" green ''foo''
highlight String
\ cterm=NONE ctermfg=35 ctermbg=bg
\ gui=NONE guifg=#00af5f guibg=bg
" titles for output from ":set all", ":autocmd" etc.
highlight Title
\ cterm=NONE ctermfg=123 ctermbg=238
\ gui=NONE guifg=#87ffff guibg=#444444
" TODO XXX
highlight Todo
\ cterm=bold ctermfg=161 ctermbg=181
\ gui=bold guifg=#d7005f guibg=#d7afaf
" lightbeige int, long, ... ctermfg
highlight Type
\ cterm=NONE ctermfg=170 ctermbg=bg
\ gui=NONE guifg=#d75fd7 guibg=bg
" gray Visual selection
highlight Visual
\ cterm=NONE ctermfg=215 ctermbg=238
\ gui=NONE guifg=burlywood guibg=gray30
" gray Visual selection
highlight VisualNOS
\ ctermfg=215 ctermbg=238 ctermbg=bg
\ gui=NONE guifg=#5090c0 guibg=gray30
highlight WarningMsg
\ cterm=NONE ctermfg=green ctermbg=black
\ gui=NONE guifg=green guibg=black
highlight WildMenu
\ cterm=NONE ctermfg=23 ctermbg=148
\ gui=NONE guifg=#005f5f guibg=#afd700
if &term == "xterm-256color" && $DISPLAY == ""
" Cygwin mintty doesn't do italic.
highlight Comment cterm=NONE
highlight LineNr cterm=NONE
endif
The 6x6x6 colorcube to chose the cterm color numbers from:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With