summaryrefslogtreecommitdiff
path: root/01_Functions.zsh
diff options
context:
space:
mode:
authorHugues Hiegel <hugues@hiegel.fr>2007-09-28 11:36:36 +0200
committerHugues Hiegel <hugues@hiegel.fr>2008-03-07 14:15:18 +0100
commit8f6bc5b80619fb51e43f7718a4886cf9823a35b4 (patch)
tree5184311bc9a2a44f0eb71fbe45151be230961b86 /01_Functions.zsh
parent9274321f6a355957057150175346acf2e7e6cd18 (diff)
"Modularized" and automagic on-demand git-status.
Conflicts: .zsh/01_Functions.zsh .zsh/11_Prompts.zsh .zsh/user:hugues/KeyBindings.zsh
Diffstat (limited to '01_Functions.zsh')
-rw-r--r--01_Functions.zsh32
1 files changed, 30 insertions, 2 deletions
diff --git a/01_Functions.zsh b/01_Functions.zsh
index a8973e7..66ed509 100644
--- a/01_Functions.zsh
+++ b/01_Functions.zsh
@@ -14,6 +14,29 @@ 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-)
@@ -21,14 +44,19 @@ get_git_branch ()
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