ZSH

ZSH + Oh My ZSH is an open-source framework to make your shell experience better.

Install

  1. Install ZSH (I used brew).
  2. Install Oh My ZSH (I used curl).

Shell profile

Edit and apply changes

# Edit your ZSH profile
# Note: I aliased this to "zedit"
nano ~/.zshrc

Changes won’t apply until you source or restart your shell.

# Source your ZSH profile
# Note: I aliased this to "zsource"
source ~/.zshrc

Customizations

Add this to the end of your shell profile:

# -----------------------------------------------
# Oh My ZSH! Config
# -----------------------------------------------

# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"

# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="robbyrussell"

# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git)

source $ZSH/oh-my-zsh.sh


# -----------------------------------------------
# NVM (Node version manager)
# -----------------------------------------------

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

# Change Node version
alias node10="nvm use 10.16.2"
alias node14="nvm use 14.20.1"
alias node16="nvm use 16.16.0"


# -----------------------------------------------
# Customize the PATH
# -----------------------------------------------

# For Composer
export PATH="$HOME/.composer/vendor/bin:$PATH"

# For Homebrew
export PATH="/usr/local/sbin:$PATH"


# -----------------------------------------------
# Custom aliases
# -----------------------------------------------

# Update shell profile
alias zedit="code ~/.zshrc"
alias zsource="source ~/.zshrc"

alias cd..='cd ..'
alias ..='cd ..'
alias ...='cd ../..'

# List files and folders
alias ll="ls -l"
alias la="ls -la"
alias lsd='ls -l | grep "^d"'

# Composer memory fix
alias memcomposer="COMPOSER_MEMORY_LIMIT=-1 composer"

# Change to repos
alias cd_repos="cd ~/work/repos"
alias cd_repos_gd="cd ~/work/repos-gravitydepartment"

# Change to project
#alias cd_{projectName}="cd ~/work/repos/{clientName}/{projectName}"

# Start project
#alias start_{projectName}="cd_{projectName} && node16 && npm run watch"