From 907dc812d7efa19cf41f8d950aec302c80ef7203 Mon Sep 17 00:00:00 2001 From: Loic Nageleisen Date: Thu, 23 Feb 2012 12:22:16 +0100 Subject: [PATCH] better term title support --- zshrc | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/zshrc b/zshrc index 5667241..fd2414c 100644 --- a/zshrc +++ b/zshrc @@ -3,8 +3,8 @@ autoload -Uz promptinit promptinit -# Set up working dir change event -chpwd() { +# Set terminal title +set_term_title() { [[ -o interactive ]] || return # Bubble information up to the terminal case $TERM_PROGRAM in @@ -19,15 +19,20 @@ chpwd() { ;; esac case $TERM in - xterm*) - print -Pn "\e]0;%n@%m: %~\a" + screen*) + #print -Pn "\ek%n@%m: %~\e\\" + print -Pn "\e]2;%n@%m: %~\a" + ;; + xterm*|*rxvt*) + print -Pn "\e]2;%n@%m: %~\a" ;; *) # NOOP ;; esac } -chpwd # call in right now + +set_term_title # call in right now # Use emacs keybindings even if our EDITOR is set to vi bindkey -e @@ -111,13 +116,22 @@ zstyle ':vcs_info:*' formats "%F{green}%S%f:%F{blue}%b%f:%F{green}%r%f" precmd() { psvar=() + set_term_title vcs_info RPROMPT="%F{green}%~%f" [[ -n $vcs_info_msg_0_ ]] && RPROMPT="$vcs_info_msg_0_" } +preexec() { + set_term_title +} + PS1="%B%(?..[%?] )%b%n@%m> " prompt_opts=(cr percent) +chpwd() { + set_term_title +} + source ~/.aliases