summaryrefslogtreecommitdiff
path: root/zshrc
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2013-04-15 16:51:13 +0000
committerweasel <weasel@bc3d92e2-beff-0310-a7cd-cc87d7ac0ede>2013-04-15 16:51:13 +0000
commit57fd52fc18ce868c81ad71c1485b0c8dcd782d41 (patch)
tree826543467835f0141d265cff10987e74ecf40119 /zshrc
parent4a1a2ed3d80d1a94cca24cfea04196778b9cb2ba (diff)
Fix a long standing title annoyance
git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@613 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede
Diffstat (limited to 'zshrc')
-rw-r--r--zshrc35
1 files changed, 17 insertions, 18 deletions
diff --git a/zshrc b/zshrc
index edf7b19..bfe0c60 100644
--- a/zshrc
+++ b/zshrc
@@ -1,7 +1,7 @@
#! /bin/false
if [ -e /etc/zsh/zshenv ]; then
- . /etc/zsh/zshenv
+ . /etc/zsh/zshenv
fi
HOSTNAME="`hostname`"
@@ -253,13 +253,13 @@ fi
case $TERM in
xterm*|rxvt*)
function update-title() {
- print -Pn "\033]0;$1\007"
+ print -n "\033]0;$1\007"
}
function build-and-update-title() {
local location cmd title
- location="$1"
- cmd="$2"
- if [ "$cmd" = "" ]; then
+ location="$(print -P $1)"
+ cmd="${2:-}"
+ if [ -z "$cmd" ]; then
title="$location"
else
title="$cmd [$location]"
@@ -272,19 +272,18 @@ case $TERM in
screen*)
if [ -n "${TMUX:-}" ] && [ -x /usr/bin/tmux ] ; then
function update-title() {
- print -Pn "\033]0;$1\007"
+ print -n "\033]0;$1\007"
}
function build-and-update-title() {
local location cmd title
- location="$1"
- cmd="$2"
- if [ "$cmd" = "" ]; then
- tmux rename-window `print -Pn "%~"`
- title="%n@%m"
+ location="$(print -P $1)"
+ cmd="${2:-}"
+ if [ -z "$cmd" ]; then
+ title="$location"
+ tmux rename-window "$title"
else
tmux setw automatic-rename on > /dev/null
- title="$cmd [$location]"
- title=`echo $title | tr '\n' ' '`
+ title="$location:$cmd"
fi
update-title "$title"
}
@@ -294,12 +293,12 @@ case $TERM in
}
function build-and-update-title() {
local location cmd title
- location="$1"
- cmd="$2"
- if [ "$cmd" = "" ]; then
- title=`print -Pn "%~"`
+ location="$(print -P "%~")"
+ cmd="${2:-}"
+ if [ -z "$cmd" ]; then
+ title="$location"
else
- title=`print -Pn "%~:$cmd"`
+ title="$location:$cmd"
fi
update-title "$title"
}