Powerlevel10k
Table of Contents
This article explores tools for customizing your terminal. Earthly revolutionizes your build process through robust caching and parallel execution. It’s power-tool for building software. Check it out.
In the ever-evolving landscape of development tools, the terminal remains a constant companion for every developer. It’s not just a black box where commands are executed; it’s a personalized workspace that can be as simple or as intricate as you want it to be.
While setting up my new M1 MacBook, I noticed that my terminal prompts looked pretty plain and were missing the information I’m used to. This led me on a journey to explore beyond the default themes of “Oh My ZSH” and discover the power and beauty of modern prompt customization tools like Starship and Powerlevel10k.
On my last machine, I had installed “Oh My ZSH” and was using their default theme. It looked pretty nice but the main thing I liked was the git information: what branch I was on, where I had commits to push or pull and so on.
In the past, I had heard people speak fondly of Starship. It was written in Rust. It was fast. It had a beautiful website. So I thought I might try using it on my machine’s prompt line. But googling around I found that there was a new kid in town that was perhaps better: Powerlevel10k. I decided to give it a try and while it may be a bit early to draw a conclusion, so far it’s working well.
Why Powerlevel10k
Powerlevel10k and Starship are both powerful. Starship works with many shell, while Powerlevel only works with ZSH, so that is the first reasons to exclude it. If you want a common prompt across Bash ZSH, Fish shell and ZSH, Starship is the one you want. Also Starship has invested more time into documenting the available config options.
But if you are using ZSH, Powerlevel10k can really shine. This comparison by the Powerlevel creator won me over. Powerlevel10k is faster, more customizable, and it has a great wizard that runs when you first install it, that walks your through all the options you’d want configured. ( If you need to do things outside of the Wizards options, then you are writing ZSH config values yourself, but to me that wasn’t a huge draw back. )
The trickiest part is just the initial installation.
Installation
To install Powerlevel10k, first install ‘Oh My ZSH’:
#install Oh My ZSH
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
( When you install Oh My Zsh, it renames your existing .zshrc
file to .zshrc.pre-oh-my-zsh
. So make sure to copy over any important details from it and then rm ~/.zshrc.pre-oh-my-zsh
)
Then clone the repo and setup Powerlevel as your theme in .zshrc
# Clone powerlevel repo
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
sed -i 's/ZSH_THEME=.*/ZSH_THEME=powerlevel10k\/powerlevel10k/' ~/.zshrc
Then source your .zshrc and you should be good. The wizard will guide you through the rest of the steps. If you have any font issues, you can manually install the fonts by running p10k configure
or grabbing the fonts yourself and installing them.
Visual Studio Code Terminal Integration
I like to use the VS Code Terminal integration but initially the prompt provided by Powerlevel10k contained some broken characters. This is the custom font causing issues again, but its easy to fix.
- On Mac: press ⌘ , or click Code → Preferences → Settings.
- Enter terminal.integrated.fontFamily in the search box at the top of Settings tab and set the value below to
MesloLGS NF
. - Restart VS Code and you are good.
More VS Code tweaks found on GitHub if you are still having issues.
Ok, let’s cover some common Powerlevel10k questions.
How to Uninstall Powerlevel10k?
If you decide that Powerlevel10k isn’t for you, uninstalling it is straightforward. Simply remove the theme directory and revert your .zshrc
to its previous state.
# Remove the Powerlevel10k directory
rm -r ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
# Revert to your previous theme in .zshrc
sed -i 's/ZSH_THEME=powerlevel10k\/powerlevel10k/ZSH_THEME=your_previous_theme/' ~/.zshrc
# Reload your .zshrc
source ~/.zshrc
How to Configure Powerlevel10k?
After installation, Powerlevel10k runs a configuration wizard to help you set up your prompt. If you skipped it or want to reconfigure your settings, you can run:
p10k configure
This will launch the wizard again, allowing you to customize your prompt to your liking.
How to Update Powerlevel10k?
Keeping Powerlevel10k up-to-date ensures that you benefit from the latest features and performance improvements. To update, navigate to the Powerlevel10k directory and pull the latest changes from GitHub.
# Navigate to the Powerlevel10k directory
cd ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
# Update from GitHub
git pull
After updating, you may want to run p10k configure
to see if there are new configuration options available.
How Do I Change the Prompt Colors?
The .p10k.zsh
file is usually located in your home directory (~/.p10k.zsh) and contains the configuration for the prompt. This file is large and you should probably back it before you start making changes. Once backed up, start making some changes. There are many code comments guiding your customization efforts. You may also want to just ask questions on r/ZSH.
- POWERLEVEL9K_TIME_FOREGROUND=66
+ POWERLEVEL9K_TIME_FOREGROUND=66
How Is It?
In the realm of terminal customization, the journey is often as rewarding as the destination. Customization can be its own end. So now that I have my pretty prompt with git details stuffed in it, do I still like it or was all the fun just in the playing around?
Yes, I’m pretty happy with it. Its a bit longer then the ZSH prompt I had before because it includes the branch name, but so far I like having the branch listed. It’s also supposed to be faster then the default ZSH theme. I don’t notice a difference, but I’m happy speed is something they are keeping an eye on.
So, if you’re looking to elevate your terminal experience from merely functional to truly delightful, give Powerlevel10k a try. It’s more than just a pretty face for your command line. It’s a robust tool that streamlines your workflow and keeps you informed, all without slowing you down.
Earthly Cloud: Consistent, Fast Builds, Any CI
Consistent, repeatable builds across all environments. Advanced caching for faster builds. Easy integration with any CI. 6,000 build minutes per month included.