From 9b48a845d1b49f7f7615aebbebff20530cd2c2e1 Mon Sep 17 00:00:00 2001 From: Lorrin Nelson Date: Thu, 27 Jan 2011 16:53:11 -0800 Subject: [PATCH] Introduce DISABLE_AUTO_TITLE option --- lib/functions.zsh | 10 +++++--- lib/termsupport.zsh | 44 +++++++++++++++++++----------------- templates/zshrc.zsh-template | 3 +++ 3 files changed, 33 insertions(+), 24 deletions(-) diff --git a/lib/functions.zsh b/lib/functions.zsh index 914f2ef25..65f5f6751 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -12,14 +12,18 @@ function title { } function precmd { - title zsh "$PWD" + if [ "$DISABLE_AUTO_TITLE" != "true" ]; then + title zsh "$PWD" + fi } function preexec { emulate -L zsh local -a cmd; cmd=(${(z)1}) - title $cmd[1]:t "$cmd[2,-1]" -} + if [ "$DISABLE_AUTO_TITLE" != "true" ]; then + title $cmd[1]:t "$cmd[2,-1]" + fi + } function zsh_stats() { history | awk '{print $2}' | sort | uniq -c | sort -rn | head diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index fef978748..b4e7d0baa 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -1,21 +1,23 @@ -case "$TERM" in - xterm*|rxvt*) - preexec () { - print -Pn "\e]0;%n@%m: $1\a" # xterm - } - precmd () { - print -Pn "\e]0;%n@%m: %~\a" # xterm - } - ;; - screen*) - preexec () { - local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} - echo -ne "\ek$CMD\e\\" - print -Pn "\e]0;%n@%m: $1\a" # xterm - } - precmd () { - echo -ne "\ekzsh\e\\" - print -Pn "\e]0;%n@%m: %~\a" # xterm - } - ;; -esac \ No newline at end of file +if [ "$DISABLE_AUTO_TITLE" != "true" ]; then + case "$TERM" in + xterm*|rxvt*) + preexec () { + print -Pn "\e]0;%n@%m: $1\a" # xterm + } + precmd () { + print -Pn "\e]0;%n@%m: %~\a" # xterm + } + ;; + screen*) + preexec () { + local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} + echo -ne "\ek$CMD\e\\" + print -Pn "\e]0;%n@%m: $1\a" # xterm + } + precmd () { + echo -ne "\ekzsh\e\\" + print -Pn "\e]0;%n@%m: %~\a" # xterm + } + ;; + esac +fi diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index 8022b3506..506daa9a2 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -14,6 +14,9 @@ export ZSH_THEME="robbyrussell" # Uncomment following line if you want to disable colors in ls # export DISABLE_LS_COLORS="true" +# Uncomment following line if you want to disable autosetting terminal title. +# export DISABLE_AUTO_TITLE="true" + # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) # Example format: plugins=(rails git textmate ruby lighthouse) plugins=(git)