new "doubletime" theme with more granular git status markers and two-line prompt
authorKarl Swedberg <kswedberg@gmail.com>
Sun, 27 Feb 2011 22:54:35 +0000 (17:54 -0500)
committerKarl Swedberg <kswedberg@gmail.com>
Sun, 27 Feb 2011 22:54:35 +0000 (17:54 -0500)
themes/doubletime/doubletime.theme.bash [new file with mode: 0644]

diff --git a/themes/doubletime/doubletime.theme.bash b/themes/doubletime/doubletime.theme.bash
new file mode 100644 (file)
index 0000000..e1f91f5
--- /dev/null
@@ -0,0 +1,66 @@
+#!/bin/bash
+SCM_THEME_PROMPT_DIRTY=''
+SCM_THEME_PROMPT_CLEAN=''
+SCM_GIT_CHAR='${bold_cyan}±${normal}'
+SCM_SVN_CHAR='${bold_cyan}⑆${normal}'
+SCM_HG_CHAR='${bold_red}☿${normal}'
+SCM_THEME_PROMPT_PREFIX=""
+SCM_THEME_PROMPT_SUFFIX=""
+RVM_THEME_PROMPT_PREFIX=" ("
+RVM_THEME_PROMPT_SUFFIX=")"
+
+doubletime_scm_prompt() {
+  CHAR=$(scm_char)
+  if [ $CHAR = $SCM_NONE_CHAR ]
+  then
+    return
+  else
+    echo "$(git_prompt_status)"
+  fi
+}
+
+prompt_setter() {
+  # Save history
+  history -a
+  history -c
+  history -r
+  PS1="
+\t $(scm_char) [\[$blue\]\u@local\[$reset_color\]] \w
+$(doubletime_scm_prompt)\[$reset_color\] $ "
+  PS2='> '
+  PS4='+ '
+}
+
+PROMPT_COMMAND=prompt_setter
+
+git_prompt_status() {
+
+  if [ -n "$(git status | grep 'Changes not staged' 2> /dev/null)" ]; then
+    git_status="${bold_red}$(scm_prompt_info) ✗"
+  elif [ -n "$(git status | grep 'Changes to be committed' 2> /dev/null)" ]; then
+     git_status="${bold_yellow}$(scm_prompt_info) ^"
+  elif [ -n "$(git status | grep 'Untracked files' 2> /dev/null)" ]; then
+     git_status="${bold_cyan}$(scm_prompt_info) +"
+  elif [ -n "$(git status | grep 'nothing to commit' 2> /dev/null)" ]; then
+     git_status="${bold_green}$(scm_prompt_info) ${green}✓"
+  else
+    git_status="$(scm_prompt_info)"
+  fi
+  echo "[$git_status${normal}]"
+
+}
+
+# git_prompt_color() {
+#
+#   if [ -n "$(git status | grep 'Changes not staged' 2> /dev/null)" ]; then
+#     git_status='${bold_red} ✗'
+#   elif [ -n "$(git status | grep 'Changes to be committed' 2> /dev/null)" ]; then
+#      git_status='${bold_yellow} ^'
+#   elif [ -n "$(git status | grep 'Untracked files' 2> /dev/null)" ]; then
+#      git_status='${bold_cyan} +'
+#   else
+#     git_status='${bold_green} ✓'
+#   fi
+#   echo $git_status
+#
+# }