1
0
mirror of https://github.com/kremalicious/dotfiles.git synced 2024-11-22 01:37:14 +01:00

bash tweaks

This commit is contained in:
Matthias Kretschmann 2014-05-23 16:11:05 +02:00
parent c9ae684025
commit 5cb8180f5c
2 changed files with 18 additions and 1 deletions

View File

@ -31,6 +31,17 @@ export LANG="en_US"
# fuck that you have new mail shit # fuck that you have new mail shit
unset MAILCHECK 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 # PATH
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------

View File

@ -55,7 +55,13 @@ function parse_git_dirty() {
} }
function parse_git_branch() { 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\]" 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\]"