Vim Issue With Changing Color Schemes - vim

I originally used the colorscheme Solarized Dark, which worked completely fine. I also used the correct iTerm2 theme to go along with it. Then, I made a switch to the Gruvbox colorscheme, and I switched to the GruvBox iTerm2 theme to go with that. This also worked fine.
My problem occurred when I attempted to switch back to the Solarized Dark color scheme. I would post images if I could, but here's what the relevant section of my .vimrc is:
set t_Co=256
syntax enable " enable syntax processing
"Solarized Settings
let g:solarized_termcolors=256
set background=dark
colorscheme solarized
These are the same settings I used when I first used the Solarized color scheme, and they worked fine.
But now, it looks like maybe the syntax colors are correct, but the background is pretty much black. And even if I add the let g:solarized_transcolors=1 settings (which I never had to do before), which fixes the black background, the line number column, as well as buffer header (on top), also have black backgrounds.
Any insight into this issue would be appreciated. Note that I have also tried with a completely fresh .vimrc file and .vim folder, yet I still ran into the same problem, so I don't think this can be because of any conflicts among color schemes.
My suspicion is that the vim program is somehow storing old background colors it uses and prevents them from changing.

Related

set background=dark in .vimrc does not change vims background

I added set background=dark in my .vimrc but my vim is still with a light background.
Am I missing something? Do I have to compile something so that my changes are used?
Edit:
I am Using a Debian Stretch distribution and I had to reinstall vim, because I failed to use SpaceVim, but this Problem occured before as well.
I have also noticed this text in .viminfo:
:set background=dark
|2,0,1555...47,,"set background=dark"
I don't understand this snippet but I guess that this would not hinder vim to get the setting out of .vimrc(?)
http://vimdoc.sourceforge.net/htmldoc/options.html#%27background%27
When set to "dark" or "light", Vim will try to use colors that look good on a dark (or light) background.
Setting this option does not change the background color, it tells Vim what the background color looks like.

Wrong Colors of Solarized in Vim

The problem I'm having is that the colors look really strange, but ONLY when I set the background to dark. It looks just like an official screenshot with light background mode:
[1]
But this is what I get when I set the background to dark:
[2]
It looks the same in vim and gvim. I tried changing a bunch of options like termtrans, t_Co, solarized_termcolors, contrast & visibility, reinstalled vim... Changing solarized_termcolors to 16 (or anything other than 256) makes it look even worse.
http://ethanschoonover.com/solarized/vim-colors-solarized
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.

Solarized colorscheme for vim and incorrect background color

I use urxvt with the Solarized light color palette. My .Xresources file is properly configured according to these instructions. I also use Vim as my main editor. I've installed the Solarized colorscheme for Vim and modified my .vimrc file according to these instructions. I like the light background color, so I put the following lines in .vimrc
syntax enable
set background=light
colorscheme solarized
However, Vim set the background color to dark. Then I edited the second line, wrote set background=dark and vim changed the background color to light.
The problem is that set background=light gives me the dark background and set background=dark gives me the light background. Why this weird behavior? How to fix this problem? Ah, if I leave out the set background line, everything looks fine (the background is light). I've also noticed that gvim sets the correct background color.
Well, I found what's going wrong. The official (?) Solarized for X Windows is broken when using light colors. There's a discussion here and here. The color scheme didn't adjust to the value of background. I solved the problem using the config from seletskiy configuration.

Vim Solarized Color scheme: Should I have to set `call pathogen#infect()` in my .vimrc to make the syntax highlighting work properly?

I'm new to vim and was wondering if I was supposed to have the call pathogen#infect in my .vimrc file. If I don't have this it tells me E185: Cannot find color scheme solarized. I realize there are many questions out there on this topic but this one in specific I found difficult to answer.
Is there a better way to do this?
Details:
Mac OSX
iTerm
ZSH (don't think this matters but thought I'd throw it in there.)
Also is this how the color scheme should look outside of files?
Articles referenced:
Vim highlighting with solarized color scheme
E185: Cannot find color scheme solarized
solarized coloring only *fully* working in .vimrc file, other files have syntax coloring issues
E10 errors in .vimrc
Adjust colors in vimrc or rather in the color scheme itself
It depends on how you installed Solarized. If it sits beneath ~/.vim/bundle then yes, you need to call pathogen#infect(). (No package under there will be available otherwise.)
Your screenshot looks exactly like mine, although I never considered the possibility that I might be getting the wrong colours.

Solarized theme on Vim + Terminator + Ubuntu 11.10

I am trying to setup solarized theme for vim on Terminator but it is not working. :-(
I was successfully able to setup solarized for terminator but it just doesn't seem to work for vim. Here is what my .vimrc looks like
call pathogen#infect()
filetype plugin indent on
syntax enable
set background=dark
"set t_Co=16
"let g:solarized_termcolors=16
let g:solarized_visibility = "high"
let g:solarized_contrast = "high"
colorscheme solarized
$TERM is set to xterm
I have also tried it with the two lines above uncommented but still not working.
Could someone please tell me what I am doing wrong?
Thanks!
Edit:
As Ethan Schoonover pointed out in his vim colorscheme readme, to make the colorscheme work first you have to configure your terminal colour palette.
In terminator there is a github repo that holds the colour configuration for the dark and light scheme.
The problem is that that palette isn't right either :P, the correct one is the one a guy posted in an issue on that same repo.
The correct configuration is the following (at least for the dark scheme):
[[solarized-dark]]
palette = "#073642:#dc322f:#859900:#b58900:#268bd2:#d33682:#2aa198:#eee8d5:#002b36:#cb4b16:#586e75:#657b83:#839496:#6c71c4:#93a1a1:#fdf6e3"
cursor_color = "#eee8d5"
foreground_color = "#eee8d5"
background_color = "#002b36"
After that, you have to configure the solarized colorscheme:
syntax on
set t_Co=16
set background=dark
colorscheme solarized
A couple of things to have in mind:
Normally, the set t_Co=16 line is not necessary because most terminal emulators only support 16 colours (terminator for example). But I rather be explicit than implicit (specially if you are going to sync your files between multiple computers).
The line set g:solarized_termcolors=16 is the default, so you can put it or not: it won't make any difference.
In my experience the 256 colour version is better (I like more grey background over a blue one; but that's personal taste :P). Contrary to what everyone could think, the 256 colour scheme is actually the 'fallback' being the 16 one the default. Yeah, weird, most people would think that 256 > 16. Anyway, to use the 'fallback' you have to change the lines to the following:
set t_Co=256
set g:solarized_termcolors=256
There are actually some issues with colour output in other CLI applications, I suggest you to go and read Seebi article about dircolors and an ongoing(?) discussion on the solarized github issue tracker.
Pretty sure you don't need the vim color theme import, since you already set up the color scheme for terminator. At least, that was the only way I could get it to play nice after lots of trial and error.
Here's a screenshot of my vimrc, from vim, within terminator:
As you can see, I haven't got the line
colorscheme solarized
So you could try taking that out - it finally seems to be working for me!
ps your screenshot doesn't look like it was taken from within terminator - unless we are talking about different terminators, of course.
Try adding this to your .vimrc file
let g:solarized_termcolors=16
The rest of the settings in the screenshot are fine.

Resources