Skip to content

Instantly share code, notes, and snippets.

@bryceknz
Last active November 19, 2020 12:44
Show Gist options
  • Save bryceknz/269b945877a9811f812acb70663b930e to your computer and use it in GitHub Desktop.
Save bryceknz/269b945877a9811f812acb70663b930e to your computer and use it in GitHub Desktop.
.zshrc customisations
# ZSH config
export ZSH="/Users/brycekehoe/.oh-my-zsh"
# ZSH_THEME="agnoster"
ZSH_THEME="robbyrussell" # Set theme
plugins=(git) # Load plugins
ZSH_DISABLE_COMPFIX="true" # Skip verification of insecure directories
source $ZSH/oh-my-zsh.sh # Load oh-my-zsh
# Make directory and change into it
mkdircd() { mkdir "$1" && cd "$1" }
# Handy aliases
# alias o="xdg-open ." # Open current folder in File Viewer (Ubuntu)
alias c="clear" # Clear the current Terminal window
alias q="exit" # Exit the current Terminal window
alias e="code ." # Open Visual Studio Code with current folder as active workspace
alias eq="code . && exit" # As above, then exit the Terminal window
# Linux aliases for viewing current directory contents
alias tree1="tree -L 1" # Tree list one level deep
alias treed="tree -L 1 -d" # Tree list one level deep, only directories
alias tree2="tree -L 2" # Tree list two levels deep
alias treed2="tree2 -d" # Tree list two levels deep but only directories
# Print git log to terminal
alias gitlog="git log --graph --oneline --all"
# Remove all node_modules folders recursively
alias rnm="find . -name \"node_modules\" -type d -prune -exec rm -rf '{}' +"
# Kill all existing 'node' processes
alias kn="killall node"
# NPM aliases
alias ni="npm install" # Install NPM packages
alias eni="e && ni" # Open VS code, then install NPM packages
alias eniq="e && ni && q" # As above, then quit Terminal window
alias ns="npm start" # Run NPM start script
alias nd="npm run dev" # Run NPM dev script
alias nt="npm test" # Run NPM test script
alias nr="npm run" # Run NPM run to run any script
# Navigate to workspaces folder
alias wo="cd ~/workspaces"
# This loads NVM
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
# Add yarn to PATH
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment