mirror of
https://github.com/kremalicious/dotfiles.git
synced 2024-12-22 17:23:26 +01:00
bash tweaks
This commit is contained in:
parent
c9ae684025
commit
5cb8180f5c
11
bash_profile
11
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
|
||||
# ----------------------------------------------------------------------
|
||||
|
@ -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\]"
|
Loading…
Reference in New Issue
Block a user