Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@vidbina
Last active December 18, 2015 13:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vidbina/5792438 to your computer and use it in GitHub Desktop.
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.
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