noahfrederick / vim-hemisu

A Vim color scheme with dark and light variants
https://noahfrederick.com/vim-color-scheme-hemisu/
279 stars 30 forks source link

Check the value of the global background option. #3

Closed tupton closed 12 years ago

tupton commented 12 years ago

Before, this only took into account the 'local' setting, which didn't work if 'background' was set in vimrc. Make sure that 'background' is set to the desired value before setting the color scheme to hemisu in your vimrc.

noahfrederick commented 12 years ago

Correct me if I'm misunderstanding something, but &background refers to the global option's value unless a local value is set. In other words it refers to &g:background unless &l:background is set. See http://www.ibm.com/developerworks/linux/library/l-vim-script-1/index.html#N1037B and http://vimdoc.sourceforge.net/htmldoc/eval.html#expr-option.

I am able to set background successfully in my vimrc with or without this change. Let me know if I'm missing something.

Thanks, —N

tupton commented 12 years ago

It seems you are correct about the fallback to a global option if a local one is not set.

Here's my problem: if I don't use :g, I get the light background color scheme, even when I set background=dark before loading the color scheme. The kicker is that this only happens sometimes.

Also, if I have set background=dark after setting the color scheme, only some options (like line numbers) are from the color scheme while the rest (most of the syntax) reverts to the default color scheme.

I'm beginning to wonder if I have some sort of cache somewhere that's causing me to think that changing these settings is having a different effect. Thanks for taking the time to look at it though!

noahfrederick commented 12 years ago

Hmm. I haven't seen the first problem, but yeah, the only environment where I can successfully change background after setting the colors is MacVim. In the terminal, I see what you're seeing—a few of the colors are preserved while most revert to what I guess is the default. Kinda a pain because I enjoy being able to toggle between light and dark on the fly.

The docs claim that the color scheme is reloaded when you set the background after g:colors_name is set, but something is obviously going wrong.

tupton commented 12 years ago

I'm pretty sure something about my color scheme or something to do with temp or swap files was causing this to mess up. I'm closing this pull request because it obviously is irrelevant.

Thanks for taking a look.