Permalink
Browse files

First pass as shell script extraction to git repo

  • Loading branch information...
matthewmccullough committed Jul 17, 2011
1 parent 750b2f2 commit f8a3e47b7d0e410fc8799d1cde72224c19e21ede
Showing with 13,540 additions and 0 deletions.
  1. +61 −0 .bash_gitprompt
  2. +500 −0 .bash_history
  3. +20 −0 .bash_profile
  4. +4 −0 .bashrc
  5. +13 −0 .profile
  6. +85 −0 .shellaliases
  7. +51 −0 .shellpaths
  8. +32 −0 .shellvars
  9. +1,384 −0 .zcompdump
  10. +8 −0 .zdirstore
  11. +3 −0 .zlogout
  12. +45 −0 .zprofile
  13. +292 −0 .zsh/func/prompt_wunjo_setup
  14. +286 −0 .zsh/func/prompt_wunjo_setup.matt
  15. +295 −0 .zsh/func/prompt_wunjo_setup.orig
  16. +249 −0 .zsh/func/zgitinit
  17. +10,179 −0 .zsh_history
  18. +33 −0 link.sh
View
@@ -0,0 +1,61 @@
+##############################
+# Git Commands
+#############################
+ RED="\[\033[0;31m\]"
+ YELLOW="\[\033[0;33m\]"
+ GREEN="\[\033[0;32m\]"
+ BLUE="\[\033[0;34m\]"
+ LIGHT_RED="\[\033[1;31m\]"
+LIGHT_GREEN="\[\033[1;32m\]"
+ WHITE="\[\033[1;37m\]"
+ LIGHT_GRAY="\[\033[0;37m\]"
+ COLOR_NONE="\[\e[0m\]"
+
+function parse_git_branch {
+ git rev-parse --git-dir &> /dev/null
+ git_status="$(git status 2> /dev/null)"
+ branch_pattern="^# On branch ([^${IFS}]*)"
+ remote_pattern="# Your branch is (.*) of"
+ diverge_pattern="# Your branch and (.*) have diverged"
+
+ if [[ ! ${git_status}} =~ "working directory clean" ]]; then
+ state="${RED}⚡"
+ fi
+ # add an else if or two here if you want to get more specific
+ if [[ ${git_status} =~ ${remote_pattern} ]]; then
+ if [[ ${BASH_REMATCH[1]} == "ahead" ]]; then
+ remote="${YELLOW}↑"
+ else
+ remote="${YELLOW}↓"
+ fi
+ fi
+ if [[ ${git_status} =~ ${diverge_pattern} ]]; then
+ remote="${YELLOW}↕"
+ fi
+ if [[ ${git_status} =~ ${branch_pattern} ]]; then
+ branch=${BASH_REMATCH[1]}
+ echo " (${branch})${remote}${state}"
+ fi
+}
+
+function git_dirty_flag {
+ git status 2> /dev/null | grep -c : | awk '{if ($1 > 0) print "⚡"}'
+}
+
+function prompt_func() {
+ previous_return_value=$?;
+ #The lowercase w is the full current working directory
+ #prompt="${TITLEBAR}${BLUE}[${RED}\w${GREEN}$(parse_git_branch)${BLUE}]${COLOR_NONE}"
+
+ #Capital W is just the trailing part of the current working directory
+ prompt="${TITLEBAR}${BLUE}[${RED}\W${GREEN}$(parse_git_branch)${BLUE}]${COLOR_NONE}"
+
+ if test $previous_return_value -eq 0
+ then
+ PS1="${prompt}> "
+ else
+ PS1="${prompt}${RED}>${COLOR_NONE} "
+ fi
+}
+
+PROMPT_COMMAND=prompt_func
Oops, something went wrong.

0 comments on commit f8a3e47

Please sign in to comment.