From 8f6bc5b80619fb51e43f7718a4886cf9823a35b4 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Fri, 28 Sep 2007 11:36:36 +0200 Subject: "Modularized" and automagic on-demand git-status. Conflicts: .zsh/01_Functions.zsh .zsh/11_Prompts.zsh .zsh/user:hugues/KeyBindings.zsh --- 01_Functions.zsh | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to '01_Functions.zsh') diff --git a/01_Functions.zsh b/01_Functions.zsh index a8973e7..66ed509 100644 --- a/01_Functions.zsh +++ b/01_Functions.zsh @@ -14,21 +14,49 @@ cmd_exists () which $1 2>/dev/null >&2 } +term_title() +{ + [[ -t 1 ]] && + case $TERM in + sun-cmd) + print -Pn "\e]l%n@%m %~$1\e\\" ;; + *term*|rxvt*) + print -Pn "\e]0;%n@%m (%l) %~$1\a" ;; + *) + ;; + esac +} + +preprint() +{ + hbar= + for i in {1..$(($COLUMNS - ${#1} - 5))} + do + hbar=$hbar- + done + print -Pn "${C_}0;30;1${_C}${hbar}[ $1 ]-\r${C_}0${_C}" +} + get_git_branch () { echo $(git branch 2>&- | grep -E '^\* ' | cut -c3-) } get_git_status () +{ + git-status + check_git_status +} + +check_git_status () { ## GIT TRACKING ## if [ "$GITCHECK" != "" ] then GITBRANCH=$(get_git_branch); - TEE="" if [ "$GITBRANCH" != "" ] then - preprint "Checking git status..." + preprint "Check git status..." _git_status=$(git-runstatus 2>&- | grep -E '^# ([[:alpha:]]+ )+(but not|to be)( [[:alpha:]]+)+:$') if [ "$(grep "but not" <<< $_git_status)" != "" ] ; then COLOR_GIT=$COLOR_NOT_UP_TODATE -- cgit v1.2.3