Setup vimrc with solarized color theme
Solution 1
So, check for these:
You should
set t_Co=256
in your vimrc. (read here more)You should edit the colors on your terminal, following a solarized colorscheme. Check this.
I use
syntax on
but I believesyntax enable
should do the work too.Put the solarized theme in
~/.vim/colors
Let me know if it does work after following all these steps.
Solution 2
By setting t_Co to 256 what you'll get is a degraded version of Solarized.
It's better to update your terminal color palette instead for more precise colors.
set t_Co=16
let g:solarized_termcolors=16
By setting t_Co
and solarized_termcolors
to 16 we tell Vim and Solarized to use terminal's color palette.
Solution 3
From the README (emphasis mine) :
IMPORTANT NOTE FOR TERMINAL USERS:
If you are going to use Solarized in Terminal mode (i.e. not in a GUI version like gvim or macvim), please please please consider setting your terminal emulator's colorscheme to used the Solarized palette. I've included palettes for some popular terminal emulator as well as Xdefaults in the official Solarized download available from [Solarized homepage]. If you use Solarized without these colors, Solarized will need to be told to degrade its colorscheme to a set compatible with the limited 256 terminal palette (whereas by using the terminal's 16 ansi color values, you can set the correct, specific values for the Solarized palette).
If you do use the custom terminal colors, solarized.vim should work out of the box for you. If you are using a terminal emulator that supports 256 colors and don't want to use the custom Solarized terminal colors, you will need to use the degraded 256 colorscheme. To do so, simply add the following line before the
colorschem solarized
line:let g:solarized_termcolors=256
Again, I recommend just changing your terminal colors to Solarized values either manually or via one of the many terminal schemes available for import.
What worked for me on Ubuntu 16.04 with the included Terminal application was to simply select Solarized for both "Text and Background Color" (choose light or dark) and "Palette" in Terminal > Preferences > Profiles > (select yours) > Edit > Colors
Some other answers recommend choosing a 256 color palette but, as mentioned in the documentation, this gives you a degraded (and visibly worse in my opinion) colorscheme.
Related videos on Youtube
muru
Updated on September 18, 2022Comments
-
muru over 1 year
I just started with vim in ubuntu, and have some trouble setting up my .vimrc file. This is what I currently have:
"============= Solarized color theme ============= "https://github.com/altercation/vim-colors-solarized syntax enable "Use syntax highlighting set background=dark "Use dark color scheme colorscheme solarized "Choose solarized "============= Settings ============= set nocompatible "Necesary for cool vim things set number "Line numbers set colorcolumn=80 "Have a line after 80 char set ruler "Add ruler at the bottom of vim set cursorline
However, when I can't see my cursorline and the colorcolumn with these settings. If I don't use the solarized color syntax, I do see them. Do you guys know what I am doing wrong?
-
Admin over 8 yearsMight be something to do with your terminal's palette (selection of colours). I get both: i.stack.imgur.com/XIZhE.png
-
Admin over 8 yearsCheck this out: Fix Solarized Color Scheme in Vim Ubuntu ; article I wrote a few years back
-
-
muru over 8 yearsYou shouldn't touch
t_Co
at all, but use a correct value ofTERM
(xterm-256color
,screen-256color
etc.).