commit 393b000135121a0fc48a7c59539d06bbfba60295
parent a002e26d92bbb16f403cd41e8b796338726377a9
Author: Chris Bracken <chris@bracken.jp>
Date: Tue, 5 Jun 2018 23:31:34 -0700
Fall back to xterm-256colors if necessary
When xterm-256colors-italic is unavailable, fall back to xterm-256colors.
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/.zshrc b/.zshrc
@@ -58,9 +58,13 @@ term_bin=""
if [[ -e /proc/$PPID/cmdline ]]; then
term_bin="${$(</proc/$PPID/cmdline):t}"
fi
+
+# Set TERM for known terminals, and as a fallback when specified term is
+# unavailable.
if [[ "$COLORTERM" == "gnome-terminal" ]] || \
[[ "$term_bin" == gnome-terminal* ]] || \
- [[ "$term_bin" == urxvt* ]]; then
+ [[ "$term_bin" == urxvt* ]] || \
+ [[ "$TERM" == "xterm-256color-italic" && ! $(tput -T$TERM longname > /dev/null 2>&1) ]]; then
export TERM=xterm-256color
fi
unset term_bin