darkcloud-tmuxconfig/tmux-italics-terminfo
Kevin MacMartin bc1b3826f1 Added a script to generate a terminfo file for tmux with support for
italics, and added an explanation of how and why this works to the
README.
2014-07-26 04:45:44 -04:00

26 lines
922 B
Bash
Executable file

#!/usr/bin/env bash
SRC_TERMINFO="screen-256color"
TMP_TERMINFO="/tmp/${SRC_TERMINFO}.terminfo"
echo -n "Generating ${SRC_TERMINFO}-it... "
[[ -d "${HOME}/.terminfo" ]] \
|| install -d "${HOME}/.terminfo/"
[[ -f "${HOME}/.terminfo/s/${SRC_TERMINFO}-it" ]] \
&& rm "${HOME}/.terminfo/s/${SRC_TERMINFO}-it"
infocmp "$SRC_TERMINFO" | sed \
-e 's/^screen[^|]*|[^,]*,/'${SRC_TERMINFO}'-it|'${SRC_TERMINFO}' with italics support,/' \
-e 's/%?%p1%t;3%/%?%p1%t;7%/' \
-e 's/smso=[^,]*,/smso=\\E[7m,/' \
-e 's/rmso=[^,]*,/rmso=\\E[27m,/' \
-e '$s/$/ sitm=\\E[3m, ritm=\\E[23m,/' > "$TMP_TERMINFO"
tic "$TMP_TERMINFO"
rm "$TMP_TERMINFO"
[[ ! -f "${HOME}/.terminfo/s/${SRC_TERMINFO}-it" ]] && echo "Error!" && exit 1
echo -e "Done!\n"
echo -e "Now in your tmux.conf, change:\n\n set-option -g default-terminal \"screen-256color\"\n\nto:\n\n set-option -g default-terminal \"screen-256color-it\""