May 29, 2016

How to enable true-color for neovim, tmux, and gnome-terminal

How to enable true-color for neovim, tmux and gnome-terminal

With the release of tmux version 2.2 we’re able to get true-color support inside of tmux. And because both neovim and gnome-terminal are also supporting this, we can have great looking interfaces and colorschemes inside of tmux.

However, there are some steps we need to take in order to make this work. So I created this blog post for future reference, and hopefully you might find it useful too.


So lets start with gnome-terminal. First, we need to make sure that gnome-terminal is version linked with libvte >= 0.36. In order to check this, run the following command, and if you have the correct version of gnome-terminal. The version should be greater than or equal to 0.36.

$ ldd /usr/lib/gnome-terminal/gnome-terminal-server | grep libvte

If this isn’t the case, we need to get gnome-terminal from the staging ppa and install the latest version.

$ sudo add-apt-repository ppa:gnome3-team/gnome3-staging
$ sudo apt-get update
$ sudo apt-get install gnome-terminal
# the following will remove the staging repository because we only want to
# install gnome-terminal
$ sudo add-apt-repository -r ppa:gnome3-team/gnome3-staging

You might need to restart your computer or you could restart the gnome-terminal-server. And, just to be sure, check if libvte is the correct version.

Now, let’s check if we can really get the true-color spectrum. Download the following script, and execute it.

# download script
$ wget

# make the script executable
$ sudo chmod +x

# run the script
$ ./

It should look something like the following:


Optional: support for italics

I wanted to be able to have support for italics in tmux, and this is how you do it. Create a file name xterm-256color-italic.terminfo with the following contents:

# A xterm-256color based TERMINFO that adds the escape sequences for italic.
xterm-256color-italic|xterm with 256 colors and italic,
        sitm=\E[3m, ritm=\E[23m,

Then install it by doing the following:

$ tic xterm-256color-italic.terminfo

Now you need to make sure that the terminfo is used by both your shell and tmux. Make sure the following line is present in your .bashrc or .zshrc. Depending on which shell you’re using.

export TERM=xterm-256color-italic

In your .tmux.conf file add the following line:

set -g default-terminal "xterm-256color-italic"

Now you can check if it is set correctly by typing in the following command in both the gnome-terminal and tmux.

$ echo $TERM

Now we should be able to get italics, and to check this, type the following in both gnome-terminal and tmux. This should output the word italics.

echo `tput sitm`italics`tput ritm`


On to tmux. First we need to check if we have the correct version.

$ tmux -V
# it should be >= 2.2
tmux 2.2

If it isn’t the correct version, then remove tmux from you system and install it. Get the latest tar.gz file from the following page. Extract the contents and install it. Instructions are also available on the tmux github page.

# on ubuntu:
$ sudo apt-get install -y libevent-dev libncurses-dev build-essential

$ tar -xzvf tmux-2.2.tar.gz
$ cd tmux-2.2
$ ./configure && make
$ sudo make install

Now that we have the correct version we need to enable Tc terminal capability for the outer terminal (to which tmux is attached) by setting the terminal-overrides option in tmux.

First it will be reported as missing.

$ tmux info | grep Tc
Tc: missing

And by adding the following line to your .tmux.conf file (you might need to restart your terminal):

set-option -ga terminal-overrides ",xterm-256color:Tc"

# When you're using the italic setup use the following line
set-option -ga terminal-overrides ",xterm-256color-italic:Tc"

The flag will be set to true:

$ tmux
$ tmux info | grep Tc
197: Tc: (flag) true

Now check the true-color capabilities of tmux by executing the script we used with the gnome-terminal.

$ ./


To enable true color capabilities for neovim add the following line to your init.vim file (located at ~/.config/nvim/):

set termguicolors

Now you can choose a colorscheme that doesn’t force neovim to use 256 colors, or one that doesn’t contain the line if !has('gui_running'). When it doesn’t it will use the guifg and guibg colors from the colorscheme.


Jan Pieter Bruins Slot