TUI: force italics in tmux

tmux users are encouraged to use "tmux-256color" instead of the old
"screen-256color". Put this in your .tmux.conf :

    if-shell 'infocmp tmux-256color' 'set -g default-terminal "tmux-256color"' 'set -g default-terminal "screen-256color"'

If default-terminal is "tmux-256color" AND tmux finds its terminfo, THEN
it will enable italics (regardless of whether the terminfo contains
sitm/ritm).

OTHERWISE tmux "emulates screen", which means it emits italics as
"reverse". That's unfortunate, but it's an acceptable compromise that
allows Nvim to support italics in tmux by default in compatible (and
increasingly-common) configurations.

Test case:

    tmux
    nvim -u NORC +'hi Comment cterm=italic' CMakeLists.txt

ref #9598
This commit is contained in:
Justin M. Keyes 2019-02-11 10:24:03 +01:00
parent 2beb731ed4
commit ee21fe3d2a

View File

@ -1607,6 +1607,8 @@ static void patch_terminfo_bugs(TUIData *data, const char *term,
} else if (tmux) {
unibi_set_if_empty(ut, unibi_to_status_line, "\x1b_");
unibi_set_if_empty(ut, unibi_from_status_line, "\x1b\\");
unibi_set_if_empty(ut, unibi_enter_italics_mode, "\x1b[3m");
unibi_set_if_empty(ut, unibi_exit_italics_mode, "\x1b[23m");
} else if (terminfo_is_term_family(term, "interix")) {
// 2017-04 terminfo.src lacks this.
unibi_set_if_empty(ut, unibi_carriage_return, "\x0d");