diff --git a/.gitmodules b/.gitmodules index ee0271d..b24e966 100644 --- a/.gitmodules +++ b/.gitmodules @@ -16,3 +16,6 @@ [submodule "shell/z"] path = shell/z url = git@github.com:jimeh/z.git +[submodule "shell/bash/git-aware-prompt"] + path = shell/bash/git-aware-prompt + url = git@github.com:jimeh/git-aware-prompt.git diff --git a/shell/bash/colors.sh b/shell/bash/colors.sh deleted file mode 100644 index 9a023ac..0000000 --- a/shell/bash/colors.sh +++ /dev/null @@ -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 diff --git a/shell/bash/git-aware-prompt b/shell/bash/git-aware-prompt new file mode 160000 index 0000000..e20cea2 --- /dev/null +++ b/shell/bash/git-aware-prompt @@ -0,0 +1 @@ +Subproject commit e20cea24a84bd5e454ba45e9964df31e0efc5929 diff --git a/shell/bash/helpers.sh b/shell/bash/helpers.sh deleted file mode 100644 index 662ceb2..0000000 --- a/shell/bash/helpers.sh +++ /dev/null @@ -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='' -} diff --git a/shell/bash/prompt.sh b/shell/bash/prompt.sh index 994aed1..dc74c17 100644 --- a/shell/bash/prompt.sh +++ b/shell/bash/prompt.sh @@ -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 diff --git a/shell/bashrc.sh b/shell/bashrc.sh index aefae9a..d350f92 100644 --- a/shell/bashrc.sh +++ b/shell/bashrc.sh @@ -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