My Oh My Zsh Setup

oh my zsh



Oh my zsh is an open source project that allows you to customize your z shell.
I use it for the following reasons:
  • It makes my terminal look pretty
  • It shows me what git branch I am on
  • It shows me the status of my git repo
  • It shows me the exit code for failed commands
  • It shows my currently activated virtual environment
  • It shows me my currently selected python version (via pyenv)
  • It auto corrects my command line typos

Installation

Navigate to the installation page at https://ohmyz.sh/#install, copy the curl command to perform the installation.

A script will run that installs oh my zsh and modifies your ~/.zshrc file to load it.

Configuration

By default oh my zsh will set your theme for you and do some basic configuration.
I prefer to use the powerlevel10k theme, which can be found here: https://github.com/romkatv/powerlevel10k
I followed the recommended getting started steps:
  1. Install the recommended font
  2. Install powerlevel10k use the brew install
  3. Open a new terminal (this will start the configuration wizard)
The configuration wizard will create a file called ~/.p10k.zsh that contains all the configuration choices you made during the configuration.
I like to modify how the virtual environment is displayed so that it's easier to read, by making these changes:
typeset -g POWERLEVEL9K_VIRTUALENV_FOREGROUND=11
typeset -g POWERLEVEL9K_VIRTUALENV_BACKGROUND=12
typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_WITH_PYENV=true
typeset -g POWERLEVEL9K_PYENV_FOREGROUND=3
This allows me to display both my python version from pyenv and my virtual environment from poetry:


Comments