My Updated ZSH Config 2025
So, this is my updated Zsh config! To be honest there’s little that’s changed over the years since I originally posted about this a good three years ago now in My Zsh Config. But! The changes are substantial enough for me to justify a new post. I essentially write this for me to come back to when I need to go through this process again.
With the improvements I discovered on a whim when I thought to myself, “should opening this shell up always be this slow?” Then went on a little side quest in Speeding Up My ZSH Shell so I thought I better document the rest of the changes I made.
Tl;Dr: It’s essentially the same config, but faster (see previous paragraph) and with Volta instead of nvm. 😂
Much like the previous post though, this will be a walkthrough of getting set up, from scratch with a new shell! I’ll be walking through this in a fresh install of Ubuntu 24.04.
Install Zsh
Ok, as stated, this is going to be a fresh install of Ubuntu 24.04, I’ll be going through the steps I do, so you can follow along, I’ll be adding links to the sources if you’re not ok with pasting random commands into your terminal!
1sudo apt install zsh -y
2# enter sudo passwordThis will install Zsh but that’s it, I can access from here by
entering zsh but I’m not going to do that I’m going to go straight
to installing Oh My Zsh.
Install Oh My Zsh
So, Oh My Zsh (for my use case) allows you to add plugins and themes, which is what I’m using it for. There’s a load of other super useful stuff on there which I’ve not looked into, like, ever! 😅
Install is a one liner from the website:
1sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
2# when prompted to change default to zsh, enter y
3# enter sudo password againSo, I’m prompted to change default to zsh, and yes, I do want that, thanks!
Now, for me, I’m essentially gutting the .zshrc file and adding in
my config I’ve detailed in the Speeding Up My ZSH Shell post.
You can have a poke around in the .zshrc file, there’s a load of
info in there to get familiar with the file contents.
Have a look around, I use nano to edit files:
1nano ~/.zshrcFor the next section I’m essentially adding in the theme and plugins I’m using. So, going from this:
1ZSH_THEME="robbyrussell"
2
3plugins=(git)To this:
1ZSH_THEME="spaceship"
2
3plugins=(
4 git
5 zsh-autosuggestions
6 zsh-syntax-highlighting
7)For the purposes of this exercise, this is just to confirm the theme and plugins are working, I’ll switch to my preferred config when it’s up and running.
After editing the .zshrc file in nano it’s Ctrl+o to save and Ctrl+x to exit the file.
Adding plugins and themes
So, Zsh plugins! There’s a lot! I essentially use three, the built in git one and zsh-autosuggestions and zsh-syntax-highlighting.
That’s it, you can go bananas installing all you like, there’s a
performance overhead though so be aware of this if you adding in a
load of extensions.
For the auto suggestions plugin, in the instructions in the GitHub repo it’s essentially add this (zsh-autosuggestions)
to your plugin array and run this command:
1git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestionsThen add in my autosuggest preferred settings:
1# Autosuggest settings
2ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#663399,standout"
3ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE="20"
4ZSH_AUTOSUGGEST_USE_ASYNC=1That’s going to give me some nice looking autosuggestions now!
Onto the syntax highlighting, same again, I already have the zsh-syntax-highlighting in the plugin array and in the instructions it’s run this command:
1git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlightingDone for the plugins! Now the theme!
I like Spaceship Prompt, there’s loads of other options out there, I’ve been with this one for many years now and see no reason to switch!
1# Clone the repo
2git clone https://github.com/spaceship-prompt/spaceship-prompt.git "$ZSH_CUSTOM/themes/spaceship-prompt" --depth=1
3# Link the theme
4ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme"There’s a load of config you can use for spaceship, see the spaceship-prompt repo for details! I’ll be taking my preferred config from the Speeding Up My ZSH Shell post.
1ZSH_THEME="spaceship"
2
3# Spaceship settings
4SPACESHIP_PROMPT_ASYNC=true
5SPACESHIP_PROMPT_ADD_NEWLINE=true
6SPACESHIP_CHAR_SYMBOL="⚡"
7
8# Minimal spaceship sections for performance
9SPACESHIP_PROMPT_ORDER=(
10 time
11 user
12 dir
13 git
14 line_sep
15 char
16)Aight! Plugins and theme sorted!
Volta
So, as a JavaScript developer I need tooling and differing node versions, nvm was the way for me until I was recommended Volta by JYC, thanks!
So, this isn’t essentially a Zsh thing and more of a me thing! But, this is what I’ll be referring to when I want to get set up with a new shell instance! For me, this is exactly where this should be!
Install is a one liner from the website:
1curl https://get.volta.sh | bashSo, now I can install node, pnpm, npm-check-updates, etc. Essentially any global package I need, I install it with Volta now.
Global aliases
I still use the super awesome auto expansions from gotbletu (no idea how to pronounce that!) but the video (from over 7 years ago now) on ZSH Global Alias Expansion - Linux ZSH is still solid and what I still have in my config!
Check out my dotfiles repo for that and my .zshrc config too!
The Config
That’s it, as mentioned earlier you can check out my dotfiles repo for the full config!
Here’s where I’m at with it currently:
1# Performance optimizations
2DISABLE_AUTO_UPDATE="true"
3DISABLE_MAGIC_FUNCTIONS="true"
4DISABLE_COMPFIX="true"
5
6# Cache completions aggressively
7autoload -Uz compinit
8if [ "$(date +'%j')" != "$(stat -f '%Sm' -t '%j' ~/.zcompdump 2>/dev/null)" ]; then
9 compinit
10else
11 compinit -C
12fi
13
14# Oh My Zsh path
15export ZSH="$HOME/.oh-my-zsh"
16
17# Theme config
18ZSH_THEME="spaceship"
19
20# Spaceship settings
21SPACESHIP_PROMPT_ASYNC=true
22SPACESHIP_PROMPT_ADD_NEWLINE=true
23SPACESHIP_CHAR_SYMBOL="⚡"
24
25# Minimal spaceship sections for performance
26SPACESHIP_PROMPT_ORDER=(
27 time
28 user
29 dir
30 git
31 line_sep
32 char
33)
34
35# Carefully ordered plugins (syntax highlighting must be last)
36plugins=(
37 git
38 zsh-autosuggestions
39 zsh-syntax-highlighting
40)
41
42# Source Oh My Zsh
43source $ZSH/oh-my-zsh.sh
44
45# Autosuggest settings
46ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#663399,standout"
47ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE="20"
48ZSH_AUTOSUGGEST_USE_ASYNC=1
49
50# Alias expansion function
51globalias() {
52 if [[ $LBUFFER =~ '[a-zA-Z0-9]+$' ]]; then
53 zle _expand_alias
54 zle expand-word
55 fi
56 zle self-insert
57}
58zle -N globalias
59bindkey " " globalias
60bindkey "^[[Z" magic-space
61bindkey -M isearch " " magic-space
62
63# Lazy load SSH agent
64function _load_ssh_agent() {
65 if [ -z "$$SSH_AUTH_SOCK" ]; then
66 eval "$(ssh-agent -s)" > /dev/null
67 ssh-add ~/.ssh/id_github_sign_and_auth 2>/dev/null
68 fi
69}
70
71autoload -U add-zsh-hook
72add-zsh-hook precmd _load_ssh_agent
73
74# Path configurations
75export VOLTA_HOME="$HOME/.volta"
76PATH="$VOLTA_HOME/bin:$PATH:/home/scott/.turso:/home/scott/.local/bin"
77export PATH
78
79# Source aliases last
80[ -f ~/.zsh_aliases ] && source ~/.zsh_aliasesWrapping Up
Ok, so that’s my Zsh config updated! Everything’s running super smooth now. The shell opens instantly with the improvements I made in the Speeding Up My ZSH Shell post, I’ve got Volta handling my global tool installs, and everything’s set up just how I like it.
If you’re following along with this, remember this is my config that I’ve tweaked over the years - take what works for you and leave what doesn’t!
Like I said at the start, I write these posts mainly for me to refer back to when I inevitably need to set up a new machine. But if you’ve found it useful, that’s awesome! 🙌
Right, back to actually using the terminal instead of tweaking it… until the next side quest catches my eye! 😅
There's a reactions leaderboard you can check out too.
Sign up for the newsletter
Want to keep up to date with what I'm working on?
Join other developers and sign up for the newsletter.
I care about the protection of your data. Read the Privacy Policy for more info.