AI TL;DR
Too lazy to read? Summarize this post with:
Blog Post Publish Date: 2024/02/08
ZSH + Starship: A Productivity Masterpiece#
This blog post covers how I ended up with ZSH and Starship as my terminal setup. It walks through the shells I tried along the way, my favorite ZSH plugins and ZSH options, my minimal Starship configuration, and a step-by-step guide to reproduce it from scratch.
The Shells I Tried#
Productivity is a topic I really enjoy. For a long time, I used a plain Bash terminal. It forced me to memorize commands, but it did not make me productive, so I decided to improve my setup.
xonsh: Python + Bash Advantages (and Disadvantages)#
Because I work a lot with Python, I used xonsh for about six months. xonsh is a superset of Python with extra shell primitives that Bash users already know. Mixing Python syntax with Bash commands is productive, but debugging can get hard. Imagine a Python list comprehension combined with dictionaries and Bash environment variables in the same line.
zsh: Extensible and Production-Ready (If Customized)#
I wanted to come back to a more conventional shell, so I gave ZSH a chance. ZSH is a highly customizable shell with a large plugin ecosystem. It won me over, especially with Spaceship, a "minimalistic, powerful and extremely customizable ZSH prompt", and oh-my-zsh, a framework that manages plugins and themes. I thought I had found a stable balance between productivity and simplicity, but on my macOS workstation, the input and startup delay got on my nerves.
I searched blog posts and YouTube videos for tips, but nothing fixed it. So I installed the plugins manually, without oh-my-zsh, and tried Starship. In my words, Starship is "a Spaceship alternative, written in Rust, blazing fast, with many stars on GitHub".
The results were great. Moving my theme from Spaceship to Starship took almost no effort, and the performance was exactly what I wanted.
fish: Ready to Use (But Not POSIX-Compliant)#
More recently, I tried Fish, described as "a smart and user-friendly command line shell". Its performance and default features impressed me, and Starship supports it too. Out of the box, Fish already has syntax checking with color indicators, autosuggestions based on history, and a selection menu for command options and arguments. It's simple and ready to use.
The drawback is that Fish does not follow the POSIX sh definition. For example, FOOBAR=123 does not declare a variable. You have to write set FOOBAR 123 instead. That rules Fish out of my daily work, but if ZSH were not an option, I would happily use it.
My Favorite ZSH Plugins#
ZSH has a huge number of plugins. They are usually installed and managed by oh-my-zsh, but you can install them directly, because a plugin is just a script file with a set of functions. These are the ones I can't work without.
zsh-autosuggestions: Remembers Commands for You#
This is my favorite plugin, no doubt. It copies a Fish feature: as you type, it suggests a completion based on your history.

More Details: zsh-users/zsh-autosuggestions
zsh-syntax-highlighting: Valid Commands by Color#
Another plugin inspired by Fish. When a command is typed correctly, it turns green. Otherwise, it turns red, so you catch typos before pressing Enter.

More Details: zsh-users/zsh-syntax-highlighting
kubectl: The k Alias for kubectl#
This plugin adds Kubernetes completion and short aliases for common kubectl commands. For example:
# shortcut for: kubectl get pods
kgp
# shortcut for: kubectl delete cm foobar-config-map
kdelcm foobar-config-map
# shortcut for: kubectl get cronjob
k get cj
More Details: ohmyzsh/ohmyzsh/plugins/kubectl
I use the same kind of aliases when I study for the Kubernetes certifications. My
workstation setup for the CKA, CKAD, and CKS exams covers the ones that save the most time.
My Starship Configuration#
Simplicity is elegance. My Starship prompt shows only the information I care about:
aws: only the profile name of my AWS session.
git: only the branch, nothing else.
python: the active virtualenv.
kubernetes: the Kubernetes context name. I style it differently depending on the name, so study, test, and production clusters are easy to tell apart.
My full
~/.config/starship.toml: c-neto/ansible-configure-fedora/files/dotfiles/starship.toml
My Favorite ZSH Options (setopt)#
Some features that Bash or Fish have by default, such as comments in the prompt or sharing history, must be enabled explicitly in ZSH. You enable them with setopt in ~/.zshrc. Running set -o lists every option and whether it's on, and the ZSH Options Reference describes each one.
These are the options I enable:
INTERACTIVE_COMMENTS: allows#comments in the interactive shell.APPEND_HISTORY: appends new entries to the history file instead of overwriting it.INC_APPEND_HISTORY: writes each command to the history file as soon as it runs.HIST_IGNORE_DUPS: does not record a command that repeats the previous one, which also makes zsh-autosuggestions faster.HIST_IGNORE_SPACE: does not record commands that start with a space.
My full
~/.zshrc: c-neto/ansible-configure-fedora/files/dotfiles/.zshrc
How to Set Up My ZSH + Starship From Scratch#
All my dotfiles are on GitHub: c-neto/ansible-configure-fedora/files/dotfiles/
1 optional: Back up your current dotfiles (
~/.zshrcand~/.zsh_history):
cp "$HOME/.zshrc" "$HOME/.zshrc.backup"
cp "$HOME/.zsh_history" "$HOME/.zsh_history.backup"
2: Install ZSH with your package manager.
# if Linux (Fedora)
dnf install zsh
# if MacOS
brew install zsh
3: Install Starship:
curl -sS https://starship.rs/install.sh | sh
About Nerd Fonts: The
~/.config/starship.tomlfile from step 5 does not need Nerd Fonts. If emojis don't render correctly, installing one may help.
4: Create the directories for the ZSH plugins and the Starship configuration:
mkdir "$HOME/.config/"
mkdir "$HOME/.my-custom-zsh/"
5: Download my ~/.config/starship.toml:
curl 'https://raw.githubusercontent.com/c-neto/ansible-configure-fedora/main/files/dotfiles/starship.toml' > "$HOME/.config/starship.toml"
6: Install the plugins manually:
# k alias
curl 'https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/plugins/kubectl/kubectl.plugin.zsh' > "$HOME/.my-custom-zsh/kubectl.plugin.zsh"
# zsh-syntax-highlighting
git clone --depth 1 'https://github.com/zsh-users/zsh-syntax-highlighting.git' "$HOME/.my-custom-zsh/zsh-syntax-highlighting"
# zsh-autosuggestions
git clone --depth 1 'https://github.com/zsh-users/zsh-autosuggestions' "$HOME/.my-custom-zsh/zsh-autosuggestions"
7: Download my ~/.zshrc:
curl 'https://raw.githubusercontent.com/c-neto/ansible-configure-fedora/main/files/dotfiles/.zshrc' > "$HOME/.zshrc"
Key Binding Tip
You can change the
bindkeyvalues to your preference. To find the code for a key, runcat -vand press the key: its code appears in the shell. Then map functions such asforward-wordandbackward-wordto that code.More details about the bindkey standard widgets: https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html#Zle-Widgets
8: Restart your terminal. The result looks like this:

Why I Settled on ZSH + Starship#
Productivity is a moving target. Tools should fit what you need now, and it's fine to change them when your work changes.
For my DevOps routine today, ZSH with Starship is a balanced, cross-platform choice with good performance, productivity, and room to extend. If you want to go further, ZSH also lets you write your own key bindings, which I cover in
Hacking Your Zsh Terminal with Custom Widgets, and
fzf turns history and file search into an interactive menu.
Fish still gets an honorable mention: its default configuration inspired most of the plugins I use in ZSH.
Key Takeaways#
xonsh mixes Python and Bash productively, but debugging mixed syntax gets hard.
oh-my-zsh is convenient, but on my macOS machine it made startup and input noticeably slow. Installing plugins manually fixed that.
Starship is a fast, Rust-based prompt that replaced Spaceship with almost no configuration changes.
Fish is excellent out of the box, but it is not POSIX-compliant, which rules it out for my daily work.
zsh-autosuggestions, zsh-syntax-highlighting, and the kubectl plugin bring Fish-like features and Kubernetes aliases to ZSH.
Enable
INTERACTIVE_COMMENTSand the history options withsetoptin~/.zshrc.Keep the prompt minimal: show only the context you check all the time, such as git branch, AWS profile, virtualenv, and Kubernetes context.
References#
My dotfiles:
.zshrcandstarship.toml
I'm Carlos Neto, and this blog is a brain dump of my career experience. More about me on my home page. If you have questions or a different approach, contact me on LinkedIn or leave a comment below.