summaryrefslogtreecommitdiff
path: root/01_Functions.zsh
diff options
context:
space:
mode:
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