I typically use iTERM2 with zsh and Oh My Zsh! themes. My current theme uses color control commands and a Powerline font:
# vim:ft=zsh ts=2 sw=2 sts=2
# Must use Powerline font, for \uE0A0 to render.
ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}\uE0A0 "
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}!"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?"
ZSH_THEME_GIT_PROMPT_CLEAN=""
ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg_bold[red]%}‹"
ZSH_THEME_RUBY_PROMPT_SUFFIX="›%{$reset_color%}"
PROMPT='
%{$fg_bold[grey]%}%n@%m%{$fg_bold[white]%}:%{$fg_bold[green]%}$(shrink_path --fish)%{$reset_color%}$(git_prompt_info) ⌚ %{$fg_bold[red]%}%*%{$reset_color%}
$ '
RPROMPT='$(ruby_prompt_info)'
Anyways. On the rare occasion I need to run XQuartz with xterm. Because of the above configuration, xterm cannot deal with the above color codes, and thus emits a bunch of garbage after each prompt:
I've tried testing for xterm using the $TERM
variable in my .zshrc and theme files, however it's always xterm
.
So my question, what's the best way to detect the terminal environment between XQuartz xterm and iTerm terminal so I can toggle/disable the theme?
xterm
would not support escape codes for color. Whatever problem you have, that is not it.watch
emoji or SVG powerline fonts that are in use with my prompt.