Last active
December 18, 2015 13:49
-
-
Save vidbina/5792438 to your computer and use it in GitHub Desktop.
The code appended to my .bashrc or my .bash_profile (OSX) to keep my prompt short and sweet.
This file contains 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
function parse_git_rep { | |
git remote -v 2> /dev/null | \ | |
sed -e '/fetch)$/!d' | \ | |
grep "[a-zA-Z0-9_-]*/[a-zA-Z0-9_-]*\.git" -o --color=never | \ | |
sed -e 's/.git/ /' | |
} | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | \ | |
sed -e '/^[^*]/d' -e 's/* \(.*\)/î‚ \1 /' | |
} | |
function proml { | |
local BLACK="\[\033[0;30m\]" | |
local DARK_GRAY="\[\033[1;30m\]" | |
local BLUE="\[\033[0;34m\]" | |
local LIGHT_BLUE="\[\033[1;34m\]" | |
local GREEN="\[\033[0;32m\]" | |
local LIGHT_GREEN="\[\033[1;32m\]" | |
local CYAN="\[\033[0;36m\]" | |
local LIGHT_CYAN="\[\033[1;36m\]" | |
local RED="\[\033[0;31m\]" | |
local LIGHT_RED="\[\033[1;31m\]" | |
local PURPLE="\[\033[0;35m\]" | |
local LIGHT_PURPLE="\[\033[1;35m\]" | |
local LIGHT_GREEN="\[\033[1;32m\]" | |
local BROWN="\[\033[0;33m\]" | |
local YELLOW="\[\033[1;33m\]" | |
local LIGHT_GRAY="\[\033[0;37m\]" | |
local WHITE="\[\033[1;37m\]" | |
case $TERM in | |
xterm*) | |
local TITLEBAR='\[\033]0;\u@\h:\w\007\]' | |
;; | |
*) | |
local TITLEBAR="" | |
;; | |
esac | |
local REPOSITORY="$LIGHT_GREEN\$(parse_git_rep)" | |
local BRANCH="$YELLOW\$(parse_git_branch)" | |
local PROMPT="$LIGHT_RED$ $LIGHT_GRAY" | |
export PS1="$REPOSITORY$BRANCH$PROMPT" | |
PS2='> ' | |
PS4='+ ' | |
} | |
proml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment