Idan Yadgar
Idan Yadgar

Reputation: 1034

Cmder changes Vim's colors under WSL

I am using Vim under WSL (Ubuntu) and I installed Cmder for the support of unicode.
Also, I downloaded the codedark colorscheme for Vim and under CMD it works perfectly:
enter image description here

But when I open it with Cmder, this is the result:
enter image description here

As you can see, the colors are not the same.

In Cmder, I chose Monokai as my colorscheme in the settings, and if I change it to something else, it changes the colorscheme of Vim too.

Why doesn't Vim override those settings when its on?
How can I make Vim use the same colorscheme under any console?

Upvotes: 1

Views: 1030

Answers (1)

Matt
Matt

Reputation: 15091

Why doesn't Vim override those settings when its on?

A console application (such as Vim) is not allowed to access OS graphics API directly. Instead, it talks to the terminal (Cmder), which, in turn, talks to OS.

Your screen has 24-bit colors (16 million), but Cmder provides for Vim only 8 bits (256 colors). Therefore, Vim can choose from only 256 indexes in Cmder's palette, i.e. a subset of some preselected colors (when you choose a colorscheme in terminal, you actually select colors in that palette). As those colors more or less differ from original codedark scheme, the resulting picture looks different too.

How can I make Vim use the same colorscheme under any console?

Make sure your terminal offers a proper palette. Or switch both terminal and Vim to TrueColor mode. For Vim, it requires setting an option termguicolors on. For Cmder, I'm not really sure, but ConEmu, which Cmder is based on, does suppot TrueColor, so you can make a try.

Upvotes: 2

Related Questions