Skip to content

Instantly share code, notes, and snippets.

@nobitagit
Last active August 19, 2017 22:22
Show Gist options
  • Save nobitagit/ff1ba49537fd29362252 to your computer and use it in GitHub Desktop.
Save nobitagit/ff1ba49537fd29362252 to your computer and use it in GitHub Desktop.
My terminal bash profile
# nvm config
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
PINK=$'\e[35;40m'
GREEN=$'\e[32;40m'
YELLOW=$'\e[33;40m'
RED=$'\e[0;31m'
# use node 4 as default
nvm use 4 &>/dev/null
# export PS1="\e[0;32m[\t]\e[0m${YELLOW}\$(parse_git_branch) => \e[1;35m\w\e[0m \n-> "
export PS1="\e[0;32m[\t]\e[0m${YELLOW}\$(parse_git_branch) \e[0m\$(parse_git_color) \e[1;35m\w\e[0m \n-> "
export CLICOLOR=1
export LSCOLORS=dxFxCxDxBxegedabagacad
# Show current branch name
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \1/'
}
parse_git_dirty() {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working tree clean" ]] && echo "*"
}
parse_git_color() {
if [ "$(parse_git_branch)" != "" ] ; then
if [ "$(parse_git_dirty)" == "*" ] ; then
echo "${RED}●" # dirty state
else
echo "${GREEN}●" # as these are emojis colors do not matter, but let's leave them defined anyway
fi
else
echo "${YELLOW}=>"
fi
}
# Autocompletion for git commands and branches.
# See: http://code-worrier.com/blog/autocomplete-git/
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
# Aliases
alias code='cd ~/Code'
alias codl='cd ~/Code ; ls -la'
alias work='cd ~/Code/work'
alias cpath='pwd|pbcopy'
# open in Sublime (followed by the directory or file path, or just the .)
alias subl='open -a "Sublime Text"'
alias ll='ls -la'
alias ws='open -a "webstorm"'
alias vsco='open -a "Visual Studio Code"'
# copy current branch name to clipboard
alias cpbr='git name-rev --name-only HEAD | pbcopy && echo "Copied branch name."'
# pip should only run if there is a virtualenv currently activated
export PIP_REQUIRE_VIRTUALENV=true
### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"
[[ -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