Skip to content

Instantly share code, notes, and snippets.

@taiansu
Forked from ihower/gist:897951
Created August 8, 2011 07:01
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taiansu/1131333 to your computer and use it in GitHub Desktop.
Save taiansu/1131333 to your computer and use it in GitHub Desktop.
bash_profile setting
export CLICOLOR=1;
export LSCOLORS=ExFxCxDxBxegedabagacad;
function git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return;
echo "("${ref#refs/heads/}") ";
}
function git_since_last_commit {
now=`date +%s`;
last_commit=$(git log --pretty=format:%at -1 2> /dev/null) || return;
seconds_since_last_commit=$((now-last_commit));
minutes_since_last_commit=$((seconds_since_last_commit/60));
hours_since_last_commit=$((minutes_since_last_commit/60));
minutes_since_last_commit=$((minutes_since_last_commit%60));
echo "${hours_since_last_commit}h${minutes_since_last_commit}m ";
}
PS1="[\[\033[1;32m\]\w\[\033[0m] \[\033[0m\]\[\033[1;36m\]\$(git_branch)\[\033[0;33m\]\$(git_since_last_commit)\[\033[0m\]$ "
[ -f ~/.git-bash-completion.sh ] && . ~/.git-bash-completion.sh;
[[ -s "$HOME/.rvm/scripts/rvm" ]] &&. "$HOME/.rvm/scripts/rvm"; # Load RVM function
alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'" #enable tree command like linux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment