Skip to content

Instantly share code, notes, and snippets.

@dearfrankg
Created January 23, 2019 16:56
Show Gist options
  • Save dearfrankg/1f6deb7d8f23a8cb26b4557b60a314ce to your computer and use it in GitHub Desktop.
Save dearfrankg/1f6deb7d8f23a8cb26b4557b60a314ce to your computer and use it in GitHub Desktop.
###########################################################
## CUSTOM ZSH CONFIG FOR FRANKG
## ALIASES
## EDITOR
alias vs='code'
## CUSTOM_ZSH
CUSTOM_ZSH=~/.zsh_custom/zsh_custom
alias be='vs $CUSTOM_ZSH ; source $CUSTOM_ZSH '
## SHELL COMMANDS
alias ls='gls --color=tty --group-directories-first '
alias ll='clear; ls -l'
alias la='clear; ls -la'
alias lo='clear; ls *'
alias md='take'
alias env='env | sort '
# BREW
alias bc='brew cask'
## DEV ENVIRONMENT
alias pg='clear; cd ~/dev/code ; lo'
alias docs='vs ~/.docs'
## NOTES
alias notes='vs ~/MY_BOOKS'
alias blog='cd ~/dev/apps/blog/official-blog-2018'
## GIT COMMANDS
alias git='hub'
alias gc='code ~/.gitconfig'
alias gl='git ls -n 10'
alias gs='git st'
alias rv='git remote -v'
## NVM
alias nv='echo "node: `node --version` npm: `npm --version` " '
## NODE
alias npml='npm list --depth=0'
## ELECTRODE
alias e-app='yo electrode'
alias e-com='yo electrode:component'
alias e-coma='yo electrode:component-add'
#################################
## LOAD PLUGINS
for file in ~/.zsh_custom/plugins/* ; do
if [ -f "$file" ] ; then
. "$file"
fi
done
#################################
## VIRTUAL ENVIRONMENTS
# NVM
#
export NVM_DIR="/Users/frankg/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
# PYTHON pyenv
#
if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi
# RUBY rvm
#
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
# GO gvm
#
[[ -s "/Users/frankg/.gvm/scripts/gvm" ]] && source "/Users/frankg/.gvm/scripts/gvm"
export GOPATH="${HOME}/go"
export PATH="${GOPATH}/bin:${PATH}"
#################################
## FUNCTIONS
#---
# setTabTitle
function tt {
echo -ne "\e]1;$*\a"
}
#---
# setNvmOnDirChange
# place this after nvm initialization!
# https://goo.gl/N3VB6r
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
#---
# listSuperRepoProjects
alias ls-super=" \
cd /Users/frankg/dev/super-repo.git && \
git br | tee >(sleep 2; wc -l) >(pr -2 -w 130 -l 50 -t) > /dev/null && \
echo $COUNT && \
cd -"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment