Skip to content

Instantly share code, notes, and snippets.

@barbosa
Created July 22, 2013 22:29
Show Gist options
  • Select an option

  • Save barbosa/6058292 to your computer and use it in GitHub Desktop.

Select an option

Save barbosa/6058292 to your computer and use it in GitHub Desktop.
A simple .bash_profile file
source ~/.git-prompt.sh
# aliases
# ------------------------------
alias ls='ls -G'
alias ll='ls -al'
# colors
# ------------------------------
##################
# Code # Color #
##################
# 00 # Off #
# 30 # Black #
# 31 # Red #
# 32 # Green #
# 33 # Yellow #
# 34 # Blue #
# 35 # Magenta #
# 36 # Cyan #
# 37 # White #
##################
# Dark colors: \[\033[0;??m\]
# Light colors: \[\033[1;??m\]
function color {
echo "\[\033[$1;$2m\]"
}
c_prompt=`color 0 33`
c_path=`color 1 33`
c_branch=`color 1 32`
c_tag=`color 1 34`
c_off=`color 0 00`
# git
# ------------------------------
if [ -f ~/.git-prompt.bash ]; then
source ~/.git-prompt.bash
export PS1='[\W]$(__git_ps1 "(%s)"): '
fi
function git_branch {
__git_ps1 " %s"
}
function git_tag {
tag=`git describe --exact-match --tags HEAD 2> /dev/null`
[ -z "$tag" ] && return 1
echo " $tag"
}
# virtualenv
# ------------------------------
source /usr/local/bin/virtualenvwrapper.sh
# ps1
# ------------------------------
PS1="${c_prompt}[${c_path}\W$c_branch\$(git_branch)$c_tag\$(git_tag)${c_prompt}]${c_off} "
# reset
# ------------------------------
unset c_prompt c_path c_branch c_tag c_off
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment