Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
enable italic font on tmux

based on

  • Check if italic font is supported:
$ echo -e "\e[3mitalic\e[23m"
  • Also check:
$ infocmp $TERM | grep sitm
        sgr0=\E(B\E[m, sitm=\E[3m, smacs=\E(0, smam=\E[?7h,
$ infocmp $TERM | grep ritm
        ri=\EM, rin=\E[%p1%dT, ritm=\E[23m, rmacs=\E(B,

If nothing is returned, then here is the step to enable it:

  1. Create a the file screen-256color.terminfo with the following content:
# A screen-256color based TERMINFO that adds the escape sequences for italic.
# Install:
#   tic screen-256color.terminfo
# Usage:
#   export TERM=screen-256color
screen-256color|screen with 256 colors and italic,
        sitm=\E[3m, ritm=\E[23m,
  1. Execute the command:
$ tic screen-256color.terminfo
  1. Add the following lines to .vimrc:
set t_ZH=^[[3m
set t_ZR=^[[23m

NOTE: ^[ must be entered with <C-V><Esc> 3. Add the following line to .tmux.conf:

set -g default-terminal "screen-256color"

NOTE: It the step 3 does not work, start tmux using the following command:

$ env TERM=screen-256color tmux
Copy link

thexavier666 commented Aug 31, 2020

Thanks! Works well.
In step 3, I put the following in .vimrc

let &t_ZH="\e[3m"
let &t_ZR="\e[23m"

which is basically the same thing

Copy link

sevillaarvin commented Nov 18, 2021

Don't forget to restart after step 3 (tmux config):

tmux kill-server && tmux

Copy link

edementyev commented Mar 16, 2022


Copy link

mauroporras commented Mar 20, 2022

Does this FAQ section mean that the present Gist is not necessary anymore?:

Copy link

samuelevalperta commented Jul 22, 2022

For me starting tmux with "env TERM=screen-256color tmux" works. However I'd like to understand why should I set this env when even if I start tmux without doing it it's set to the same thing (but not working).

Copy link

itachi-19 commented Jul 26, 2022

"env TERM=screen-256color tmux" worked for me as well. Don't know why this works.

Copy link

deybhayden commented Aug 4, 2022

"env TERM=screen-256color tmux" worked for me as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment