Add git branch to bash prompt (quick&dirty)

This commit is contained in:
2015-12-05 15:59:32 +01:00
parent f86d6e0d6e
commit 3ca77abde6
3 changed files with 9 additions and 2 deletions

View File

@@ -5,6 +5,9 @@
# bash history with time
export HISTTIMEFORMAT="%F %T "
export GITAWAREPROMPT="$HOME/.bash/git-aware-prompt"
source "$GITAWAREPROMPT/main.sh"
##
## prompt games
##
@@ -42,7 +45,7 @@ PS1="$PS1"'$(if [ -L "$PWD" ]; then echo -ne "\[$On_Blue\]"; fi)'
# DYNAMIC: wd length < 6 (/, /etc, /usr, /var, /home etc) brings red wd name
PS1="$PS1"'$(if [ ${#PWD} -lt 6 ]; then echo -ne "\[$BRed\]"; else echo -ne "\[$BGreen\]"; fi)\W'
PS1="$PS1\[$Color_Off\]\[$BGreen\]]\\$\[$Color_Off\] "
PS1="$PS1\[$Color_Off\]\[$BGreen\]]"'$git_branch$git_dirty'"\\$\[$Color_Off\] "
export EDITOR=vim
export BROWSER=chromium
@@ -258,7 +261,7 @@ function title() {
fi
}
trap 'title "$BASH_COMMAND"' DEBUG
trap 'title "$BASH_COMMAND" "$BASH_COMMAND"' DEBUG
# TODO: delete this
upload() {

3
.gitmodules vendored
View File

@@ -46,3 +46,6 @@
[submodule ".vim/bundle/auto-pairs"]
path = .vim/bundle/auto-pairs
url = https://github.com/jiangmiao/auto-pairs
[submodule ".bash/git-aware-prompt"]
path = .bash/git-aware-prompt
url = https://github.com/jimeh/git-aware-prompt.git