summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugues Hiegel <hugues@hiegel.fr>2009-07-09 11:10:01 +0200
committerHugues Hiegel <hugues@hiegel.fr>2009-07-09 11:10:01 +0200
commitb3f14c0ce09c46ceb54d2bf09e2d0d8ba218aab0 (patch)
tree5ef61bbbe747b897c43beb51ea0a1d892db19290
parent508a6701fae854473b889ecd37d88133a6f68ada (diff)
[TermTitle] new caption
-rw-r--r--01_Functions.zsh19
-rw-r--r--12_Prompts.zsh2
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)"