]> git.netwichtig.de Git - user/henk/vcsh/zsh.git/commitdiff
Added vcs_info to prompt
authorHendrik Jaeger <henk@frustcomp>
Mon, 10 Nov 2014 23:42:55 +0000 (00:42 +0100)
committerHendrik Jaeger <henk@frustcomp>
Mon, 10 Nov 2014 23:42:55 +0000 (00:42 +0100)
    modified:   .zsh_functions
    modified:   .zshrc

.zsh_functions
.zshrc

index d4818ec5017b3f5ac6b38496cfc84ead13d09baf..858e7c5972148d85224c21eda440f382829b5e7d 100644 (file)
@@ -17,27 +17,35 @@ function ESC_print () {
 }
 
 preexec () {
-  if [[ "$TERM" == screen* ]] ; then
-      local CMD=${1[(wr)^(*=*|sudo|ssh|evince|-*)]}
-      ESC_print ${CMD}
-  fi
-  case $TERM in
-      (xterm*|rxvt*)
-          set_title "${(%):-"%n@%m:"}" "$1"
-          ;;
-  esac
+    case $TERM in
+        (xterm*|rxvt*)
+            set_title "${(%):-"%n@%m:"}" "$1"
+        ;;
+        (screen*)
+            local CMD=${1[(wr)^(*=*|sudo|ssh|evince|-*)]}
+            ESC_print ${CMD}
+        ;;
+    esac
 }
 
 precmd () {
-  if [[ $TERM == screen* ]] ; then
-    ESC_print "zsh"
-  fi
-
-  case $TERM in
-    (xterm*|rxvt*)
-      set_title ${(%):-"%n@%m: %~"}
-      ;;
-  esac
+    case $TERM in
+        (xterm*|rxvt*)
+            set_title ${(%):-"%n@%m: %~"}
+        ;;
+        (screen*)
+            ESC_print "zsh"
+        ;;
+    esac
+
+    vcs_info
+    if [[ -n ${vcs_info_msg_0_} ]]; then
+        local HENKSPROMPT="%(0?..%F{red}E%?%f )%(1j.%F{yellow}J%j%f .)%(3L.%F{yellow}L%L%f .)%3~ %F{green}$VCSH_REPO_NAME%f%F{yellow}${vcs_info_msg_0_}%f%# "
+        PS1="$HENKSPROMPTHEADER$HENKSPROMPT"
+    else
+        local HENKSPROMPT="%(0?..%F{red}E%?%f )%(1j.%F{yellow}J%j%f .)%(3L.%F{yellow}L%L%f .)%3~ %F{green}$VCSH_REPO_NAME%f%F{yellow}${vcs_info_msg_0_}%f%# "
+        PS1="$HENKSPROMPTHEADER$HENKSPROMPT"
+    fi
 }
 
 function vifind () {
diff --git a/.zshrc b/.zshrc
index e29b0d6fcb51f1ccd4ea5e89d7ed318336871384..57ff1526174025cf7b9de900b446f93a13368215 100644 (file)
--- a/.zshrc
+++ b/.zshrc
@@ -1,4 +1,6 @@
-. ~/.zshcomprc
+autoload -Uz vcs_info
+
+. ~/.zsh_comprc
 . ~/.zsh_functions
 . ~/.zsh_aliases
 . ~/.zsh_local
@@ -9,11 +11,9 @@ SAVEHIST=3000
 
 REPORTTIME=10
 
-PS1="%F{red}%D{%A}%f %F{green}%D{%F %T Week %V}%f %F{blue}%D{Epoch %s}%f %F{yellow}%n@%m%f
-%j %3~%# "
-PATH=~/bin:~/usr/bin:~/usr/local/bin:$PATH
+HENKSPROMPTHEADER=$'%F{red}%D{%a}%f %F{green}%D{%F %T Wk %V}%f %F{blue}%D{%s}%f %F{yellow}%n@%m%f\n'
 
-PASSWORD_STORE_DIR=.
+PATH=~/bin:~/usr/bin:~/usr/local/bin:$PATH
 
 setopt AUTO_CD
 setopt CHASE_LINKS