Introduce DISABLE_AUTO_TITLE option

This commit is contained in:
Lorrin Nelson 2011-01-27 16:53:11 -08:00
commit 9b48a845d1
3 changed files with 33 additions and 24 deletions

View file

@ -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

View file

@ -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
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