From b3f14c0ce09c46ceb54d2bf09e2d0d8ba218aab0 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Thu, 9 Jul 2009 11:10:01 +0200 Subject: [TermTitle] new caption --- 01_Functions.zsh | 19 +++++++++++++------ 12_Prompts.zsh | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/01_Functions.zsh b/01_Functions.zsh index 8824cab..87bc5b4 100644 --- a/01_Functions.zsh +++ b/01_Functions.zsh @@ -24,16 +24,22 @@ cmd_exists () term_title() { - # Jobs typeset -A command - for word in ${=2} ; command[$#comand]=$word + for word in ${=@} ; command[$#comand]=$word if [ "$command[0]" = "fg" ] then lastjob=$(ps ft `tty` | grep "[0-9]\+[[:blank:]]\+`tty | sed 's/\/dev\///'`[[:blank:]]\+T.\? \+.:.. \\\_ " | tail -n1 | cut -c32-) - set $1 $lastjob + set $lastjob + fi + if [ "$command[0]" = "screen" ] + then + # discards screen args + set "SCREEN" fi + [ ! "$@" = "" ] && set " |" $@ + [[ -t 1 ]] && case $TERM in sun-cmd) @@ -43,10 +49,11 @@ term_title() print -Pn "\e]0;%n@%m (%l) %~$@\a" # Sets term title ;; screen*) + local _sep="" + [ $# -gt 0 ] && _sep=$1 && shift # gets and discards the separator, if any. # hardstatus - print -Pn "\e]2;[SCREEN #n] ?u(u) ?%n@%m (%l) %~$@\a" # Sets hardstatus line (term title) + print -Pn "\e]2;{+b W}SCREEN #n {-b W}| {R}?u(u) ?{W}{r}%n@%m{W} ({c}%l{W}) {R}%~{W}${_sep:+$_sep \{+b Y\}}$@{-b W}\a" # Sets hardstatus line (term title) # caption - [ $# -gt 0 ] && shift # discards the first arg, which is the separator, if any print -Pn "\ek" [ "$SUDO_USER" != "" ] && print -Pn "($USER) " print -Pn "${@:-%~}" @@ -135,7 +142,7 @@ get_git_branch () # Then the result my_git_branch="[rebase $current/$last: "$(git-name-rev --name-only $(cat $REBASE_DIR/onto))".."$my_git_branch"] "$(basename $(cat $REBASE_DIR/head-name)) else - # No rebase in progress, put '(' ')' if needed + # No rebase in progress, put '(' ')' if needed [ ! "$checkouted_branch" ] && my_git_branch="($my_git_branch)" fi diff --git a/12_Prompts.zsh b/12_Prompts.zsh index 06c8611..890cee1 100644 --- a/12_Prompts.zsh +++ b/12_Prompts.zsh @@ -36,7 +36,7 @@ expand_text() preexec () { - term_title " --- " "$(echo $1 | tr ' \n' ' ;' | sed 's/%/%%/g;s/\\/\\\\/g;s/;$//')" + term_title "$(echo $1 | tr ' \n' ' ;' | sed 's/%/%%/g;s/\\/\\\\/g;s/;$//')" print -Pn "$C_$prompt_colors[exec]$_C" local lines="$(expand_text "$PROMPT$1" | sed "s/\\(.\{$COLUMNS\}\\)/\\1\\n/g" | wc -l)" -- cgit v1.2.3