True Color for Vim in Tmux
Everyone should be familiar with termguicolors, the
option that allows terminal Vim to employ 24-bit color
or true color. We use set termguicolors
for vim to display RGB colors
in our color scheme correctly.
However, true color may break if you are using Vim in tmux. If
you have set up the tmux terminal properly, and Vim did not complain
about not recognising your $TERM
, you can try adding the following to
your .vimrc
:
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
set termguicolors
See xterm-true-color for explanation.