1

I am trying to use VIM through new "Windows Terminal" app on a Windows 10 operating system. The VIM app is installed inside a debian WSL app.

I can't wrap my head around how the entire color scheme and syntax highlighting works inside a terminal app. Here are my specific questions:

  1. Is the entire color scheme managed by the terminal app? There are profiles and a JSON file to define the color scheme inside Windows Terminal. Is that how the entire user experience regarding coloring is managed?
  2. Or is it managed by the SHELL. So now when I am inside the WSL the prompt has changed from the default Power Shell colorless prompt. Makes me wanna question is the color scheme now managed by .bashrc or .zshrc file?
  3. Then inside VIM, let's say I want to use a specific theme. Let's say Monokai. There are ways to control that too on the internet.

So I just can't wrap my head around how the entire grand color scheme works. What does your setup look like?

1
  • As far as I know on Windows there are only 16 colors available. They are customizable and by default are the 16 bright colors. I suppose Vim converts the RBG colors into one of these predefined colors using a logic that I don't know exactly. That is why you have different color experience between Vim in a Windows terminal and gVim. May 17, 2022 at 12:54

1 Answer 1

1

There are several layers to vim's colors in a terminal.

A terminal emulator often allows you to set the "color palette." This is often just 16 colors (bright/bold and normal variants). The terminal being emulated (see the environment variable TERM) may have support for more (or less!) than the base 16 colors of the palette; depending on the emulator, up to 256 standard (or not so standard) colors are available. As a further complication, an emulator and/or TERM may support 24-bit or true color—this effectively gives you 6-hexit-wide RGB color codes (hence "24-bit").

A program can output color codes, such as by using special escape sequences (whether hard-coded, by lookup in terminfo, tput, curses, etc.). For example, git sometimes outputs color; many people configure their shell prompts to include color. Any use of the base 16 colors (e.g., via xterm escape sequences) will get translated through this palette. Other colors depend on the statements above and the support of the terminal.

Vim outputs color codes when it can. The colors vim uses are a combination of the palette, what the emulator supports, and :highlight and :syntax commands that make up (mostly) colorscheme and syntax files.


What you probably want to do is:

  1. Configure your emulator with a palette you like.
  2. Configure your programs to use color at appropriate times (e.g, don't use color when the output is not to a terminal!)
  3. Configure vim to use a (possibly customized) colorscheme you like.

But, "what does [my] setup look like" is too broad and has no best answer, so I won't deal with that here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.