My personal .zshrc configuration file. .zshrc# ===================================== # Basic Configuration # ===================================== # Path to your oh-my-zsh installation. export ZSH="$HOME/.oh-my-zsh" # Set the theme for oh-my-zsh. ZSH_THEME="robbyrussell" # Set the format for command history timestamps. HIST_STAMPS="yyyy-mm-dd" # List of plugins to load. plugins=(git node npm nvm ng vscode) # Source oh-my-zsh. source $ZSH/oh-my-zsh.sh # ===================================== # Aliases # ===================================== # Set personal aliases. alias nglf='ng lint --fix' alias ngs='ng s' alias brew='env PATH="${PATH//$(pyenv root)\/shims:/}" brew' # ===================================== # Autocompletion # ===================================== # Load Git autocompletion. zstyle ':completion:*:*:git:*' script ~/.zsh/git-completion.bash # Include additional directories in the function path. fpath=(~/.zsh $fpath) # Initialize autocompletion. autoload -Uz compinit && compinit # Load Angular CLI autocompletion. source <(ng completion script) # ===================================== # NVM (Node Version Manager) Configuration # ===================================== # Set up NVM directory. export NVM_DIR="$HOME/.nvm" # Load NVM and its bash_completion. [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # Function to load .nvmrc and update node version in projects. 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" ]; then nvm install elif [ "$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 } # Hook to load NVM when changing directories. add-zsh-hook chpwd load-nvmrc load-nvmrc # ===================================== # Miscellaneous # ===================================== # Source fzf (fuzzy finder) if available. [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh # Set up pyenv root directory. export PYENV_ROOT="$HOME/.pyenv" # Add pyenv binary directory to PATH. [[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"