I am using tmux, and recently found out that the same vim colorshemes inside and outside of tmux have different colors

Left is tmux in gnome-terminal, right is plain gnome-terminal, gnome-terminal has default colors:

![Left is <code>tmux</code> in <code>gnome-terminal</code>, right is plain <code>gnome-terminal</code>

EDIT: At closer look, the style does change too (look at bold etc).

Both terminals are 256-colored ones (gnome-terminal indicates himself as xterm-256color, tmux as tmux-256color, see ncurses-term package), vim sees that too (:set t_Co gives 256). I compared their color representations via

for i in `seq 0 255` ; do echo -e "$i: \e[48;5;${i}m                  \e[0m"; done

And got the same palettes:

Color paletes

I think tmux should just pass these colors to gnome-terminal, but when why vim changes?

Can I fix this? I think gnome-terminal ones are better, and want tmux to use them.

  • Which color scheme is that? Please post a copy -- it might be using rgb colors, not just 256. May 28 '16 at 23:54
  • Actually, Vim was loading desert colorsheme instead of default, see my answer. May 29 '16 at 11:17

For some reason, it was just a Vim issue: when started in tmux, it loaded default colorsheme, but when started from plain terminal, it loaded desert colorscheme but still calling it default when asked via :colorsheme. Forcing :colorsheme default resolved an issue, so I added colorsheme line in my ~/.vimrc and now it's OK.

I have no idea why Vim was doing that stuff, but forcing desired colorsheme works fine.


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.