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.
This commit is contained in:
Kevin MacMartin 2014-07-26 04:45:44 -04:00
parent 2eb64d2593
commit bc1b3826f1
2 changed files with 30 additions and 0 deletions

View file

@ -34,6 +34,10 @@
* (**copy mode**) `v`, `y` and `Escape`: Begin selection, copy selection and cancel **copy mode** respectively.
* `Alt-[0-9]` (no prefix): Switch directly to the given window.
## Italics Support ##
Tmux supports italics if your terminal does, but the terminfo files _screen_ and _screen-256color_ don't advertise this, and most programs will display reversed text when it should be italics. To fix this, run: `tmux-italics-terminfo`, then follow the instructions it displays by changing `set-option -g default-terminal "screen-256color"` to `set-option -g default-terminal "screen-256color-it"` in your _tmux.conf_. You'll want to make sure your _/etc/bash.bashrc_, _/etc/dircolors_, possibly **vim** and any other terminal applications that check the `$TERM` variable have _screen-it_ and _screen-256color-it_ added.
## Credits ##
* Written by Kevin MacMartin: [GitHub Projects](https://github.com/prurigro) | [Arch Linux AUR Packages](https://aur.archlinux.org/packages/?SeB=m&K=prurigro)

26
tmux-italics-terminfo Executable file
View file

@ -0,0 +1,26 @@
#!/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\""