$TERM issues with tmux and vim

tmux 2.1 is out (well it’s been out for a few months now), and brings with it a shiny new terminfo file: tmux-256color.

Unfortunately, switching my $TERM from screen-256color to tmux-256color inside tmux doesn’t work as expected: when starting Vim, … nothing happens. It just sits there, not showing up Vim, not giving me back my prompt, and ignoring any amount of head-bashing on the keyboard (most notably Ctrl-C and Ctrl-Z).
However, if I resize the pane (either by resizing the terminal window or by spawning a new pane inside tmux), then Vim comes to life (and all the head-bashed keystrokes happen).

tl;dr: I don’t know how to fix it (yet) except by reverting $TERM to screen-256color.

So here is what I gathered:

  • use another terminal (e.g. xterm instead of urxvt): FAIL
  • TERM=tmux-256color vim outside tmux: FAIL
  • vim --noplugin: FAIL
  • other curses programs (mutt, irssi, …) work just fine
  • infocmp /usr/share/terminfo/{s/screen,t/tmux}-256color lists the following differences (with meaning according to terminfo(5)):
    has_status_line hs: F:T
    dis_status_line dsl: NULL, '\E]0;07'
    from_status_line fsl: NULL, '^G'
    exit_italics_mode ritm: NULL, '\E[23m'
    exit_standout_mode rmso: '\E[23m', '\E[27m'
    enter_italics_mode sitm: NULL, '\E[3m'
    enter_standout_mode smso: '\E[3m', '\E[7m'
    to_status_line tsl: NULL, '\E]0;'

    Nothing ground-breaking. :(

I’m kinda stuck now, and my Google-fu has failed me so far. Perhaps debugging/tracing Vim would help.
Anyway, I’ll let it rest for a while, and come back to it later.

Leave a Reply

Your email address will not be published. Required fields are marked *