From: Simon Ruderich Date: Sat, 13 Mar 2010 20:38:21 +0000 (+0100) Subject: zsh/rc: window_title() optimization, only check TERM on startup. X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=06435c8a9f18b894ad9ab9d6363992c50b48314c;p=config%2Fdotfiles.git zsh/rc: window_title() optimization, only check TERM on startup. --- diff --git a/zsh/rc b/zsh/rc index 74011ab..c0a453e 100644 --- a/zsh/rc +++ b/zsh/rc @@ -326,14 +326,15 @@ if [[ $TERM == screen* || $TERM == xterm* || $TERM == rxvt* ]]; then } # Sets the window title. Works with screen, xterm and rxvt. - window_title() { - if [[ $TERM == screen* ]]; then + if [[ $TERM == screen* ]]; then + window_title() { print -n "\ek$1\e\\" - - elif [[ $TERM == xterm* || $TERM == rxvt* ]]; then + } + elif [[ $TERM == xterm* || $TERM == rxvt* ]]; then + window_title() { print -n "\e]2;$1\e\\" - fi - } + } + fi # Add the preexec() and precmd() hooks. add-zsh-hook preexec window_preexec