parent
c17290e75d
commit
41b49397d1
17
bashrc
17
bashrc
@ -1,6 +1,15 @@
|
||||
|
||||
# Get ourselves a nice prompt
|
||||
ks() { s="$?" ; $* ; return "$s" ; }
|
||||
prompt_gbranch() { git branch | sed -n 's/^\* (*\(.* \)*\([^ )]*\))*$/\2/p' ; }
|
||||
prompt_gbehind() { git rev-list --left-only --count @{upstream}...HEAD | sed -n 's/[^0].*/⇃&/p' ; }
|
||||
prompt_gbefore() { git rev-list --right-only --count @{upstream}...HEAD | sed -n 's/[^0].*/↿&/p' ; }
|
||||
prompt_gstatus() { git status --porcelain | sed 's/\(..\).*/\1/' | cat <(echo OK) - | tail -1 ; }
|
||||
prompt_git() {
|
||||
if git status 2>/dev/null 1>&2; then
|
||||
echo " ($(prompt_gbranch)$(prompt_gbehind)$(prompt_gbefore) $(prompt_gstatus))"
|
||||
fi
|
||||
}
|
||||
prompt_pwd() {
|
||||
pwd | sed -e "s_${HOME}_~_" -e 's_\(/*.\)[^/]*/_\1/_g'
|
||||
}
|
||||
@ -13,12 +22,7 @@ prompt_status() {
|
||||
BOLD="\[$(tput bold)\]"
|
||||
GREEN="\[$(tput setaf 2)\]"
|
||||
RESET="\[$(tput sgr0)\]"
|
||||
source /usr/share/git/git-prompt.sh
|
||||
export GIT_PS1_SHOWDIRTYSTATE=1
|
||||
export GIT_PS1_SHOWSTASHSTATE=1
|
||||
export GIT_PS1_SHOWUNTRACKEDFILES=1
|
||||
export GIT_PS1_SHOWUPSTREAM="auto verbose"
|
||||
PROMPT_COMMAND="__git_ps1 \"$BOLD[\T]$RESET $GREEN\$(ks prompt_pwd)$RESET\" \"\$(prompt_status) \""
|
||||
PS1="$BOLD[\T]$RESET $GREEN\$(ks prompt_pwd)$RESET\$(ks prompt_git)\$(prompt_status) "
|
||||
unset BOLD
|
||||
unset GREEN
|
||||
unset RESET
|
||||
@ -26,7 +30,6 @@ unset RESET
|
||||
# Completion
|
||||
complete -c man
|
||||
complete -cf sudo
|
||||
complete -cf exec
|
||||
|
||||
# Color ls
|
||||
alias ls="lr -1FG"
|
||||
|
Loading…
Reference in New Issue
Block a user