Back to Blog

Oh My Zsh Tutorial — Plugins, Themes & Custom Functions #25

Sandy LaneSandy Lane

Video: Oh My Zsh Tutorial — Plugins, Themes & Custom Functions #25 by Taught by Celeste AI - AI Coding Coach

Watch full page →

Oh My Zsh Tutorial — Plugins, Themes & Custom Functions

Oh My Zsh is a powerful framework that simplifies managing your Zsh shell configuration by organizing themes, plugins, and custom scripts. This tutorial introduces the core directory structure, essential plugins like git and z for productivity, and guides you through creating your own custom plugins with functions and aliases to tailor your terminal experience.

Code

# Example .zshrc snippet to enable Oh My Zsh with plugins and a custom function

# Set Oh My Zsh theme
ZSH_THEME="agnoster"

# Enable plugins: git for shortcuts, z for smart directory jumping
plugins=(git z)

# Source Oh My Zsh framework
source $HOME/.oh-my-zsh/oh-my-zsh.sh

# Custom function to make and enter a directory
mkcd() {
  mkdir -p "$1" && cd "$1"
}

# Custom alias for listing files in long format with human-readable sizes
alias ll='ls -lh'

# Custom plugin example: place this in ~/.oh-my-zsh/custom/plugins/myplugin/myplugin.plugin.zsh
# function to show current weather (dummy example)
weather() {
  curl wttr.in/"${1:-your_location}"
}

Key Points

  • Oh My Zsh organizes configuration into themes, plugins, custom scripts, and libraries under ~/.oh-my-zsh/.
  • Set your prompt style by changing the ZSH_THEME variable in your .zshrc file.
  • Enable useful plugins like git and z by listing them in the plugins=() array in .zshrc.
  • Create custom functions and aliases to automate frequent tasks and enhance your workflow.
  • Develop custom plugins by adding scripts in ~/.oh-my-zsh/custom/plugins/ and enabling them in .zshrc for modular customization.