4

I'm running NeoVim "straight out of the box"; after running the following commands:

mkdir -p ${XDG_CONFIG_HOME:=$HOME/.config}
ln -s ~/.vim $XDG_CONFIG_HOME/nvim
ln -s ~/.vimrc $XDG_CONFIG_HOME/nvim/init.vim

After this transfer, the colors from nvim don't match the ones for vim;

As far as I know, my colors for vim are purely the terminal colors (which are indeed customized); it seems that nvim does not fully respect those, as evidenced from the picture below. How can I made nvim respect the terminal colors?

(In the below, Vim is on the left)

Comparison of colors: Vim on the left, NeoVim on the right

  • Neovim always uses the 240 color palette. I think if you set t_Co=256 in Vim, both will come out looking the same. Look at the tests for the brown background. It's actually correct in Neovim. You may have just been used to 16 color palette. FYI: t_Co can't be changed in Neovim. – Tommy A Jul 5 '16 at 12:59
  • Thanks, I think I'm one step closer to understanding. The greyness of brown on the left is a feature-not-bug: I have configured my console to display "brown" using grey. I suppose my question then becomes: if the t_Co value cannot be changed in Neovim, how can I create a color palet (or something) that achieves the same effect of reducing the amount of colors to the set on the left (which I like)? – Klaas van Schelven Jul 5 '16 at 14:50
2

Posting an answer because a comment would be too long.

Neovim doesn't allow you to set t_Co. It detects your terminal's color capabilities using unibilium and sets t_Co accordingly. The color difference you're seeing is because Vim was using an 8 or 16 color palette.

colortest.vim uses named colors. brown in a 256 color palette will use the color index 130 while <16 color palette will use 3. 3 is yellow in the base palette.

If you want to go back to the color scheme you had before, you will need to change the highlight colors to use numeric values less than 16. But, you may want to just find their 256 color index equivalents and set your terminal's base palette back to colors that match their names: black, red, green, yellow, blue, magenta, cyan, and white. Programs expect these colors to somewhat match the name so they can at least try to ensure that text is legible on colored backgrounds.

If you adjust your theme to use the 256 palette, you could set Vim's t_Co to 256 for consistency with Neovim.

There are a couple sites that can help with color scheming if you want to go that route:

  • terminal.sexy - Helps preview the base 16 color palette. It has a lot of existing themes and can export your colors for specific terminals.
  • vivify - Create and preview vim color schemes. This also has a lot of themes. You can customize them by clicking on text to set syntax group colors.
  • base16 - Pre-made color schemes for various editors and terminals.

Your color scheme looks fairly close to the base16 "railscast" colors, which you could use as a starting point for customization:

railscast

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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