Skip to content

Instantly share code, notes, and snippets.

@tweekmonster
Created May 24, 2016 04:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tweekmonster/ca58c3b4f021525aef9a38d4907f6665 to your computer and use it in GitHub Desktop.
Save tweekmonster/ca58c3b4f021525aef9a38d4907f6665 to your computer and use it in GitHub Desktop.
Enable italics and standout in tmux
#!/bin/bash
# Generate xterm-256color and screen-256color terminfo files that supports
# italicized text and standout display style. This will override the system's
# descriptions of xterm-256color and screen-256color for your shell.
#
# To enable in tmux:
# set -g default-terminal "xterm-256color"
#
# tmux recommends creating an `tmux-256color` terminfo file and setting the
# default-terminal to "xterm", but this causes ssh sessions to not display
# correctly unless it has the correct terminfo, among other goofy behavior from
# shells that don't know what to do with TERM=tmux
#
# The drawback with tmux using "xterm-256color" is that some programs may not
# display colors correctly. This can be resolved by adding aliases for those
# programs:
# alias htop='TERM=screen-256color htop'
generate() {
tmpfile=$(mktemp /tmp/terminfo.XXXXXXX)
/usr/bin/infocmp "$1" | sed -e 's/\(ritm\|sitm\|rmso\|smso\)=[^,]\+, *//g' > $tmpfile
echo '\tritm=\E[23m, rmso=\E[27m, sitm=\E[3m, smso=\E[7m, ms@,' >> $tmpfile
/usr/bin/tic -x $tmpfile
rm -f $tmpfile
}
generate 'xterm-256color'
generate 'screen-256color'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment