Velvet Star Monitor

Standout celebrity highlights with iconic style.

updates

Setup vimrc with solarized color theme

Writer Matthew Harrington

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 ============= " 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?

2

3 Answers

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.

1

So, check for these:

  1. You should set t_Co=256 in your vimrc. (read here more)

  2. You should edit the colors on your terminal, following a solarized colorscheme. Check this.

  3. I use syntax on but I believe syntax enable should do the work too.

  4. Put the solarized theme in ~/.vim/colors

Let me know if it does work after following all these steps.

0

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.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy