This documents my current shell setup. ZSH with Oh My Zsh using the robbyrussell theme.

Smart History and Navigation

mcfly

mcfly replaces the default Ctrl+R history search. It's a neural network that ranks commands based on:

  • Current directory
  • Time of day
  • How often you've run the command

zoxide

zoxide replaces cd. It tracks directory visit frequency and recency.

z doc      # Jump to ~/Documents
z pr cod   # Jump to ~/projects/code
z -        # Previous directory
zi 	       # Interactive

yazi

yazi is a terminal file manager. This wrapper function makes your shell follow where you navigate:

y() {
    local tmp="$(mktemp -t "yazi-cwd.XXXXXX")"
    yazi "$@" --cwd-file="$tmp"
    if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
        cd -- "$cwd"
    fi
    rm -f -- "$tmp"
}

Version Managers

pyenv

pyenv for Python versions:

pyenv install 3.11.7
pyenv global 3.11.7
pyenv local 3.10.0    # Per-project

Virtual Environment Functions

mkvenv - create and activate a venv:

mkvenv           # Default Python
mkvenv 3.11      # Specific version

activate - find and activate existing venv:

activate         # Looks for venv/ or .venv/

nvm

nvm for Node versions:

nvm install 20
nvm use 20
nvm alias default 20

Oh My Zsh Plugins

  • zsh-autosuggestions - ghost text from history, right arrow to accept
  • zsh-syntax-highlighting - green = valid command, red = doesn't exist
  • history-substring-search - up/down arrow to search by prefix
  • docker - completions and aliases (dps, dimg, dex)

Aliases

..              # cd ..
serve           # python3 -m http.server, serving the current folder
cpr             # rsync -av --progress

Settings

HISTSIZE=50000
SAVEHIST=50000

PATH

  • $HOME/.pyenv/bin
  • $HOME/.local/bin
  • $HOME/.nvm
  • $HOME/.lmstudio/bin

Keyboard Shortcuts

ShortcutAction
Ctrl+Rmcfly history search
Ctrl+A / Ctrl+EStart/end of line
Ctrl+WDelete word
Ctrl+UClear line
z <name>Jump to directory
yyazi file manager
Accept suggestion
Alt+→Accept one word