diff --git a/bash_profile b/bash_profile index da82b9a..defa98e 100644 --- a/bash_profile +++ b/bash_profile @@ -31,6 +31,17 @@ export LANG="en_US" # fuck that you have new mail shit unset MAILCHECK +# Case-insensitive globbing (used in pathname expansion) +shopt -s nocaseglob + +# Autocorrect typos in path names when using `cd` +shopt -s cdspell + +# Add tab completion for many Bash commands +if which brew > /dev/null && [ -f "$(brew --prefix)/etc/bash_completion" ]; then + source "$(brew --prefix)/etc/bash_completion" +fi + # ---------------------------------------------------------------------- # PATH # ---------------------------------------------------------------------- diff --git a/bash_prompt b/bash_prompt index f13c3a7..e0617db 100644 --- a/bash_prompt +++ b/bash_prompt @@ -55,7 +55,13 @@ function parse_git_dirty() { } function parse_git_branch() { - git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/" + local branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null) + if [ -n "${branch}" ]; then + [ "${branch}" == "HEAD" ] && local branch=$(git rev-parse --short HEAD 2>/dev/null) + local status=$(git status --porcelain 2>/dev/null) + echo -n "${PURPLE}${branch}" + [ -n "${status}" ] && echo -n "*" + fi } PS1="\n\[${BOLD}${MAGENTA}\]\u \[$RESET\]at \[$ORANGE\]\h \[$RESET\]in \[$GREEN\]\w\[$WHITE\]\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" on \")\[$PURPLE\]\$(parse_git_branch)\[$WHITE\]\n→ \[$RESET\]" \ No newline at end of file