TMux terminfo

tmux doesn't ship with a terminfo file. Its documentation states that it needs a GNU screen or screen derived terminfo. Most people recommend forcing the TERM variable to xterm (resulting in bad background clearing in Vim and other applications due to incorrect bce setting), using the actual screen TERM (losing features like italic, or resulting in odd behavior for standout settings (e.g. search results from less being italic)

Other sites suggest overriding terminal settings in the application (e.g. ":set t_ut=" in Vim to override the bce setting) or patching the screen terminfo by hand, which is annoying or intimidating.

Here, I provide a terminfo file in text format that can be easily installed on any machine with a complete terminfo installation (that is, has the terminfo compiler "tic" program). This terminfo file is tested against tmux version 1.8, but will probably work fine on other versions as well.

Installation steps:

  1. Download the tmux18-256color.ti file.
  2. Compile and install on all the machines you connect to under tmux:
    tic tmux18-256color.ti
    If you do this as the root user, it will be installed system-wide. Otherwise, it will go into your local user's configuration. Either way works fine.
  3. Set the TERM setting for pty's started by tmux by adding this to your tmux.conf
    set -g default-terminal tmux18-256color

It's that simple. Now you have a real terminal type on your machines with real features reported to the applications that use it. Additionally, if you need to do specific things based on the terminal, you can actually test TERM for starting with tmux, instead of looking for screen and then for TMUX environment variables.

Technical Details

As suggested by the documentation, I started with a deconstruction of a GNU screen terminfo.

The first modification is to mandate that there is no BCE capability.

The second modification is to add sequences for enabling and disabling italics (sitm,ritm)

Third, set the general settings to use reverse video instead of italics for "standout" mode. The program "less" uses standout to highlight its searches, for example.

Fourth, set sequences for enabling and disabling standout to also use reverse video (smso,rmso)