Quantcast
Channel: What does :set background=dark do? - Vi and Vim Stack Exchange
Viewing all articles
Browse latest Browse all 5

What does :set background=dark do?

$
0
0

I didn't put color xxx in my .vimrc. So I see this when I first open my .vimrc.

:color gives me default here.Before anything

Then I type :color darcula. And it changes to this.

:color gives me darcula here (naturally).Change colorscheme

Then I type :set background=dark. And it changes to this.

:color gives me default here (amazingly).Change background

So my question is, what exactly does :set background=dark do?

I tried :h background and didn't find anything helpful. I understand that this command doesn't actually change the background, only vim will change colors accordingly. But I still want to ask this question. Because I'm really happy with the color after :color darcula and :set background=dark so I wonder how to write my own color scheme without having to put set background=dark in my .vimrc.

I took advice from @statox and put set background=dark at the last line of my darcula.vim. Then color darcula gives me the third screenshot. However when I put it at the first line, color darcula gives me the second screenshot. Also set bg=dark changes it to the third screenshot.

I assumed by putting it at the first line, I'm telling vim that this colorscheme is designed for a dark background. By putting it at the last line, on the contrast, I let vim assume that this colorscheme is designed for a light background and then make vim change some of it by itself (when it processes the last line).

If what I assume happened is true, my question is still unanswered. What exactly did vim change, when I use set bg=dark AFTER it has loaded a light colorscheme?

My entire vim configuration is available at https://github.com/MichaelMa2014/.vim


Viewing all articles
Browse latest Browse all 5

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>