Skip to content

Instantly share code, notes, and snippets.

@Digi-Cazter
Last active October 11, 2021 20:12
Show Gist options
  • Save Digi-Cazter/eee1185f3066b6014b71 to your computer and use it in GitHub Desktop.
Save Digi-Cazter/eee1185f3066b6014b71 to your computer and use it in GitHub Desktop.
Personlized .bashrc file
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo -e "\e[01;33m*\e[01;31m"
}
function parse_git_branch {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/(git::\1$(parse_git_dirty))/"
}
parse_svn_branch() {
parse_svn_url | sed -e 's#^'"$(parse_svn_repository_root)"'##g' | awk -F / '{print "(svn::"$1 "/" $2 ")"}'
}
parse_svn_url() {
svn info 2>/dev/null | sed -ne 's#^URL: ##p'
}
parse_svn_repository_root() {
svn info 2>/dev/null | sed -ne 's#^Repository Root: ##p'
}
export PS1="\[\033[00m\]\u@Navi\[\033[01;34m\] \w \[\033[31m\]\$(parse_git_branch)\$(parse_svn_branch) \[\033[00m\]$\[\033[00m\] "
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
alias atom='cd /home/donavan/code/rails/atom'
alias rails_code='cd /home/donavan/code/rails'
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment