-
-
Save ksaitor/4001959 to your computer and use it in GitHub Desktop.
Prettifies bash terminals with git
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Setup the prompt so that it shows the current branch when in a git directory. | |
source /usr/local/etc/bash_completion.d/git-completion.bash | |
source /usr/local/etc/bash_completion.d/git-prompt.sh | |
function setup_prompts_for_git | |
{ | |
local BLUE="\[\e[0;34m\]" | |
local RED="\[\e[0;31m\]" | |
local YELLOW="\[\e[0;33m\]" | |
local PURPLE="\[\e[0;35m\]" | |
local CLR_RESET="\[\e[0m\]" | |
case $TERM in | |
xterm*) | |
TITLEBAR='\[\033]0;\u@\h:\w\007\]' | |
;; | |
*) | |
TITLEBAR="" | |
;; | |
esac | |
PS1="${TITLEBAR}$BLUE[$RED\$(date +%H:%M)$BLUE][$RED\u@\h:$PURPLE\w$YELLOW\$(__git_ps1)$BLUE]$CLR_RESET\n\$ " | |
PS2='> ' | |
PS4='+ ' | |
} | |
setup_prompts_for_git |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment