Skip to content

Instantly share code, notes, and snippets.

@martimatix
Created May 26, 2018 05:06
Show Gist options
  • Save martimatix/8050ca12d73aa4418cbeb5c8471f7f1d to your computer and use it in GitHub Desktop.
Save martimatix/8050ca12d73aa4418cbeb5c8471f7f1d to your computer and use it in GitHub Desktop.
.zshrc
# Path to your oh-my-zsh installation.
export ZSH=/Users/martimatix/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell"
plugins=(git)
# User configuration
export PATH="$PATH:/Users/martimatix/.rvm/bin:/Users/martimatix/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/usr/local/.cargo/bin:/Users/martimatix/.local/bin"
source $ZSH/oh-my-zsh.sh
# Make Atom the default text editor
export EDITOR=/Applications/Atom.app/Contents/MacOS/Atom
alias subl="open -a 'Sublime Text'"
alias atom="open -a 'Atom'"
alias code="open -a 'Visual Studio Code'"
alias p="cd ~/Projects"
alias l="git log --color --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
alias s="git status"
alias b="git branch"
alias z="atom ~/.zshrc"
alias sand="~/Projects/sandbox"
alias nib="~/Projects/nib"
alias pcat="~/Projects/nib/product-catalogue-api"
# Clear merged git branches
alias gitcm="git branch --merged | grep -v \"\*\" | grep -v master | grep -v dev | xargs -n 1 git branch -d"
alias gitcane="git commit --amend --no-edit"
alias best="~/Projects/bestest"
# Aliases for nib NISS database
alias psql_auth='PGPASSWORD=onenibpassword psql -U onenibuser -p 5434 -d auth -h localhost'
alias psql_nailgun='PGPASSWORD=nisepassword psql -U niseuser -p 5433 -d niss-nailgun-api -h localhost'
alias psql_nailgun_local='PGPASSWORD=nisepassword psql -d niss-nailgun-api'
alias psql_nailgun_test='PGPASSWORD=nisepassword psql -d test-niss-nailgun-api -h localhost -p 5435 -U niseuser'
alias psql_nise_provider='PGPASSWORD=nisepassword psql -d nise-provider -p 5436 -U niseuser -h localhost'
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
autoload -U add-zsh-hook
load-nvmrc() {
local node_version="$(nvm version)"
local nvmrc_path="$(nvm_find_nvmrc)"
if [ -n "$nvmrc_path" ]; then
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
if [ "$nvmrc_node_version" != "N/A" ] && [ "$nvmrc_node_version" != "$node_version" ]; then
nvm use
fi
elif [ "$node_version" != "$(nvm version default)" ]; then
echo "Reverting to nvm default version"
nvm use default
fi
}
add-zsh-hook chpwd load-nvmrc
load-nvmrc
# direnv
eval "$(direnv hook zsh)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment