]> git.phdru.name Git - dotfiles.git/blobdiff - .bash_prompt
.muttrc: Work around a very strange bug in my `mutt`
[dotfiles.git] / .bash_prompt
index 6284416032fca32b1292d364d11c7abb459e811d..609f19f751c2997f19f4acb4ef24b30054d76f3b 100644 (file)
@@ -1,7 +1,8 @@
 #!/bin/bash
 
 # bash_prompt; adapted from
-# https://github.com/necolas/dotfiles/blob/master/shell/bash_prompt
+# https://github.com/necolas/dotfiles/blob/master/shell/bash_prompt and
+# http://vitus-wagner.livejournal.com/1176589.html?thread=40146189#t40146189
 
 prompt_git() {
     local s=""
@@ -14,7 +15,7 @@ prompt_git() {
         if [ "$(git rev-parse --is-inside-git-dir 2> /dev/null)" == "false" ]; then
 
             # ensure index is up to date
-            #git update-index --really-refresh  -q &>/dev/null
+            #git update-index --really-refresh -q &>/dev/null
 
             # check for uncommitted changes in the index
             if ! $(git diff --quiet --ignore-submodules --cached); then
@@ -163,7 +164,7 @@ set_prompts() {
           PS1="\[\033]0;\u@\h:\w\007\]"
           case "$TERM" in
              screen*)
-                PS1+"\[\033k\u@\h:\w\033\\\]" # Set screen/tmux caption
+                PS1+="\[\033k\u@\h:\w\033\\\]" # Set screen/tmux caption
              ;;
           esac
        ;;
@@ -179,6 +180,7 @@ set_prompts() {
     PS1+="\[$hostStyle\]\h " # host
     #PS1+="\[$charStyle\]: "
     PS1+="\[$wdirStyle\]\W " # working directory
+    PS1+='`erco=$?; [ $erco == 0 ] && echo -n ":)" || echo -n '"\"\[$red\]:(\[$reset\] $\""'?=$erco` '
     PS1+="\$(prompt_git \"$gitStyle\")" # git repository details
     #PS1+="\n"
     PS1+="\[$charStyle\]\$ \[$reset\]" # $ (and reset color)