Following up on a stupid question, I learned a lot about colors.

This will help you understand where all the colors you see come from.

tl;dr - They cascade like this:

  • Terminal
  • Shell
  • Vim
  • Color Schemes
  • Syntax

different

Terminal

Some terminal emulators provide color themes. These basically just rewrite the implementation of standard ANSI colors. So instead of rendering “magenta” as a pinkish color, it may render it as green.

Two iTerm themes iterm themes

Two Kitty themes kitty one kitty two

Shell

Shells provide colors for your prompt, shell scripts, and autosuggestions. These will remain consistent when using different terminals.

Fish Shell in iTerm, kitty, terminal, and alacrity shell themes

Vim

Vim doesn’t do colors by default, they are bolted in with extensions in various ways. You can see this by staring it without bells and whistles.

vim -u NONE

Like this, the terminal’s colors are what you see.

naked vim

Color Schemes

Similar to terminal emulators, Vim color schemes can change the implementation for colors. There are constant names Vim uses for colors (folded_fg, color03, etc.). Schemes change the values these names evaluate to. Using color schemes, Vim will basically look the same regardless of the terminal or shell being used.

Here are various terminal emulators using profiles (see them peeking around the edges) using various shells. peeking

Syntax

With syntax, Vim will tell the terminal to render text with various colors. The terminal color implemenation may affect what you see.

After all day doing this, somehow I forgot to get a screen shot of this. You’re not reading this anyway, though. If you are, contact me and I’ll whip one up for you.


Random Notes

In fish, https://fishshell.com/docs/current/tutorial.html fish_prompt is used to set things up.

fish_config to change Fish colors. Prompt may take a restart of the terminal emulator. ~/.config/fish/functions/fish_prompt.fish

Start kitty with a different theme. kitty -o include=”~/.config/kitty/kitty-themes/themes/AdventureTime.conf”

See what files Vim is currently using. This will have the syntax file(s). They may overwrite each other’s values, though. :scriptnames

Learn about syntax loading :help syntax-loading

Figure out your runtime. Not the same for vim & nvim. :!echo $VIMRUNTIME /usr/local/share/vim/vim81 /usr/local/Cellar/neovim/0.4.3/share/nvim/runtime

Look for the files it may be using. find {.vim,.config/nvim} -type file -name “typescript.vim”

Naked vim vim -u NONE

get the current filetype :se ft

:syntax on :syntax off View the monster… :syntax