ZSH Setup

Table of Contents

Home Tutorials Projects Blog About Me Links

Overview

ZSH is a nearly POSIX compliant shell, but the ZSH environment for development is very nice. This guide goes over install, and how I set it up, alongside my typical workflow.

I use the Oh-My-ZSH plugin manager to sort out my packages

ZSH

Installation

First lets install the ZSH package. This is how I do it on Ubuntu.

sudo apt install zsh

That handles the shell itself. Next up is our plugin manager.

oh-my-zsh reccomends you blindly execute a shell script, which I'm never a fan of. Instead lets download it, check it, then run it.

curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh >> /tmp/install.sh
less /tmp/install.sh

From a read through of the script you can see it downloads a default oh-my-zsh setup, sets ZSH to the default shell, creates your configuration files, and configures any other tidbits.

Let's go ahead and install it

sh /tmp/install.sh
# and lets cleanup
rm /tmp/install.sh

Make sure when installing we say yes to changing our default shell, and I recommend taking the oh-my-zsh template. Your old .zshrc will be backed up.

In addition, if you don't already have fzf (fuzzy-find) installed lets add it as well for an amazing auto-completion tool

git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install

This will give you great command and path auto-completion. Make sure to allow it to update your .zshrc with the appropriate source command

There's one last tool that well be using, and that's zoxide. Again they recommend blindly running shell scripts. Read it first :)

curl -sSfL https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh >> /tmp/install.sh

You can see it downloads the appropriate binary for your system architecture and distribution, and install it and the appropriate man pages. It also sets up any shell sourcing that is needed

Configuration

First off, lets set up our theme. I like powerlevel10k, because it's both pretty and I'm a die hard DBZ fan.

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k"

this will allow the theme to be loaded by oh-my-zsh, but we'll need to configure it first. First set the them in your .zshrc

ZSH_THEME="powerlevel10k/powerlevel10k"

First thing after setting the them is to install the fonts per these instructions. I use alacritty, configure it for whatever terminal you use

Then run the following:

p10k configure

select what you like here, and make sure the prompts about fonts show you have all of the fonts installed properly

After that is all set, lets configure some plugins! We'll be using some from the base oh-my-zsh plugins and some custom. lets install the custom ones first

git clone https://github.com/MichaelAquilina/zsh-you-should-use.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/you-should-use
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

Now that caps of the custom plugins I install. Lets update our plugins setting in our ~/.zshrc

Here's what I use:

plugins=(git aliases colored-man-pages colorize copyfile cp extract history tmux vi-mode zoxide virtualenv universalarchive rsync ssh
you-should-use zsh-syntax-highlighting zsh-autosuggestions)

Discussions on plugins will be below

Plugins

git

Excellent shorthand aliases for git

aliases

Show aliases and allow searching for them

als <search term>

Syntax above

colored-man-pages

Gives you access to colored man pages

colorize

Gives you colorized cat via ccat Lets you copy a whole file to clipboard via copyfile

extract

Extract command to auto-extract any archive format

history

Some aliases to search through history quicker

tmux

Some useful aliases for tmux connections

vi-mode

Give vim bindings when editing the shell session

zoxide

Initializes zoxide for you and binds it to z

virtualenv

Shows details of the currently activated virtual environment

universalarchive

Command to store anything into any archive format

rsync

Some useful rsync aliases that automatically put sane defaults

ssh

allows auto-completion of host via ~/.ssh/config

you-should-use

Prompts you of any alias you could of used instead of the long form command

zsh-syntax-highlighting

Highlights syntax :)

zsh-autosuggestions

Gives gray prompts of potential commands you could be typing akin to what fish does




Contact: Pat@PatrickCPE.com
©PatrickCPE

Date: 2026:01:11