Skip to content

Instantly share code, notes, and snippets.

@jllodra
Last active October 10, 2015 12:58
Show Gist options
  • Save jllodra/3693838 to your computer and use it in GitHub Desktop.
Save jllodra/3693838 to your computer and use it in GitHub Desktop.
.bash_profile (based on ideas and code from here and there)
# Colours
txtgrn='\[\e[0;32m\]' # Green
txtylw='\[\e[0;33m\]' # Yellow
txtblu='\[\e[0;34m\]' # Blue
txtpur='\[\e[0;35m\]' # Purple
txtcyn='\[\e[0;36m\]' # Cyan
txtwht='\[\e[0;37m\]' # White
bldblk='\[\e[1;30m\]' # Black - Bold
bldred='\[\e[1;31m\]' # Red - Bold
bldgrn='\[\e[1;32m\]' # Green - Bold
bldylw='\[\e[1;33m\]' # Yellow - Bold
bldblu='\[\e[1;34m\]' # Blue - Bold
bldpur='\[\e[1;35m\]' # Purple - Bold
bldcyn='\[\e[1;36m\]' # Cyan - Bold
bldwht='\[\e[1;37m\]' # White - Bold
txtrst='\[\e[0m\]' # Text Reset
# Function called before prompt
function pre_prompt_print(){
# Git branch
GIT_BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/[git:\1]/'`
}
PROMPT_COMMAND=pre_prompt_print
#date is not getting updated here
#PS1="$bldgrn\u$txtrst@$bldpur\h$txtrst:$bldblu\w$txtrst $bldcyn\${GIT_BRANCH}$txtrst\n$txtylw$(date "+%d-%m-%y %H:%M:%S")$txtrst> "
#date is done with \d \t
PS1="$bldgrn\u$txtrst@$bldpur\h$txtrst:$bldblu\w$txtrst $bldcyn\${GIT_BRANCH}$txtrst\n$txtylw\d \t$txtrst> "
# Git aliases
alias gita='git add'
alias gitc='git commit -m'
alias gits='git status -s'
alias gitl='git log --oneline --color'
alias gitb='git branch --color'
alias gitu='git reset --HEAD^'
# Other Aliases
alias ls='ls -G'
alias df='df -h'
alias ll='ls -lh'
alias pud='pushd'
alias pod='popd'
# Load RVM into a shell session *as a function*
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
# Add RVM to PATH for scripting
PATH=$PATH:$HOME/.rvm/bin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment