mirror of
https://github.com/jimeh/dotfiles.git
synced 2026-02-19 13:46:41 +00:00
Switch to using my git-aware-prompt project for bash
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
txtblk='\e[0;30m' # Black - Regular
|
||||
txtred='\e[0;31m' # Red
|
||||
txtgrn='\e[0;32m' # Green
|
||||
txtylw='\e[0;33m' # Yellow
|
||||
txtblu='\e[0;34m' # Blue
|
||||
txtpur='\e[0;35m' # Purple
|
||||
txtcyn='\e[0;36m' # Cyan
|
||||
txtwht='\e[0;37m' # White
|
||||
bldblk='\e[1;30m' # Black - Bold
|
||||
bldred='\e[1;31m' # Red
|
||||
bldgrn='\e[1;32m' # Green
|
||||
bldylw='\e[1;33m' # Yellow
|
||||
bldblu='\e[1;34m' # Blue
|
||||
bldpur='\e[1;35m' # Purple
|
||||
bldcyn='\e[1;36m' # Cyan
|
||||
bldwht='\e[1;37m' # White
|
||||
unkblk='\e[4;30m' # Black - Underline
|
||||
undred='\e[4;31m' # Red
|
||||
undgrn='\e[4;32m' # Green
|
||||
undylw='\e[4;33m' # Yellow
|
||||
undblu='\e[4;34m' # Blue
|
||||
undpur='\e[4;35m' # Purple
|
||||
undcyn='\e[4;36m' # Cyan
|
||||
undwht='\e[4;37m' # White
|
||||
bakblk='\e[40m' # Black - Background
|
||||
bakred='\e[41m' # Red
|
||||
badgrn='\e[42m' # Green
|
||||
bakylw='\e[43m' # Yellow
|
||||
bakblu='\e[44m' # Blue
|
||||
bakpur='\e[45m' # Purple
|
||||
bakcyn='\e[46m' # Cyan
|
||||
bakwht='\e[47m' # White
|
||||
txtrst='\e[0m' # Text Reset
|
||||
1
shell/bash/git-aware-prompt
Submodule
1
shell/bash/git-aware-prompt
Submodule
Submodule shell/bash/git-aware-prompt added at e20cea24a8
@@ -1,22 +0,0 @@
|
||||
#
|
||||
# Bash Helpers
|
||||
#
|
||||
|
||||
function find_git_branch {
|
||||
local dir=. head
|
||||
until [ "$dir" -ef / ]; do
|
||||
if [ -f "$dir/.git/HEAD" ]; then
|
||||
head=$(< "$dir/.git/HEAD")
|
||||
if [[ $head == ref:\ refs/heads/* ]]; then
|
||||
git_branch=" (${head#*/*/})"
|
||||
elif [[ $head != '' ]]; then
|
||||
git_branch=' (detached)'
|
||||
else
|
||||
git_branch=' (unknown)'
|
||||
fi
|
||||
return
|
||||
fi
|
||||
dir="../$dir"
|
||||
done
|
||||
git_branch=''
|
||||
}
|
||||
@@ -2,11 +2,13 @@
|
||||
# Bash Prompt
|
||||
#
|
||||
|
||||
PROMPT_COMMAND="find_git_branch; $PROMPT_COMMAND"
|
||||
|
||||
# Git enabled prompt
|
||||
export PS1="\[$txtrst\]\u@\h \w\[$txtcyn\]\$git_branch\[$txtrst\]\$ "
|
||||
export SUDO_PS1="\[$txtrst\]\[$bakred\]\u@\h\[$txtrst\] \w\$ "
|
||||
|
||||
# Customize prompt to act like pre-leopard
|
||||
# PS1='\h:\w \u$ '
|
||||
# Setup and use git-aware-prompt
|
||||
if [ -f "$DOTBASH/git-aware-prompt/main.sh" ]; then
|
||||
GITAWAREPROMPT="$DOTBASH/git-aware-prompt"
|
||||
source "$GITAWAREPROMPT/main.sh"
|
||||
export PS1="\u@\h \w\[$txtcyn\]\$git_branch\[$txtylw\]\$git_dirty\[$txtrst\]\$ "
|
||||
export SUDO_PS1="\[$bakred\]\u@\h\[$txtrst\] \w\$ "
|
||||
else
|
||||
# Customize prompt to act like pre-leopard
|
||||
PS1='\h:\w \u$ '
|
||||
fi
|
||||
|
||||
@@ -5,7 +5,5 @@
|
||||
# Deterimine current directory
|
||||
DOTBASH="$DOTSHELL/bash"
|
||||
|
||||
source "$DOTBASH/helpers.sh"
|
||||
source "$DOTBASH/colors.sh"
|
||||
source "$DOTBASH/prompt.sh"
|
||||
# source "$DOTBASH/bash-ido.sh"
|
||||
# source "$DOTBASH/bash-ido.sh" # Disabled for making life complicated
|
||||
|
||||
Reference in New Issue
Block a user