My Beautiful Prompt | Using Prezto & ZSH
I took my first baby steps on the command line about two years ago when I had to diagnose problems with remote installations of the IIoT application I was working on. But it wasn’t until a few months ago (when I switched to MacOS & Ubuntu), that I truly appreciated the power and awesomeness of the command line.
I’m still was astounded how many programmers are just OK with their ugly, inefficient default terminal prompts. In this post, I’m going to describe how I shifted away from the defaults and designed an efficient, customized and beautiful terminal prompt.
I started out with the default prompt on Ubuntu but I quickly developed a preference for my own set of tools. I tried bash
, experimented with zsh
and migrated to oh-my-zsh. I also tried out various terminal themes and custom prompts.
I hadn’t found quite the fit until I switched from using oh-my-zsh (it was becoming burdensome) to Prezto.
Mike Buss got me started with the giddy user contributed prompt.
Two things I loved about this prompt: - The clean separation between user@computer and directory path - The separation of information on one line and commands on the other
I started off with the giddy prompt as my basis. A few modifications got me a prompt that I am finally satisfied with.
Design Changes
I’m using the Base 16 Eighties Dark Theme for Gnome. You can find the files for other terminals at Chris Kempson’s excellent repo.
If you don’t quite like how any particular color in the theme is coming out, you can always fine-tune it through the pallete editor (from the top menu of the Gnome Terminal Preferences > Base 16 Eighties Dark Profile > Color). I’ve changed the cyan in pallete entry 7 to #C5EFF7
I’ve also modified the font strengths and arrangement of username and directory file path.
Functional Changes
Added support for active Python virtual environments
If you want to use this as your prompt or as a baseline for further customizations, feel free! You can -
- Download the file from my Github dotfiles repo
- Paste into your
.zprezto/modules/prompt/functions
path. - Modify your
.zpreztorc
as shown below.
$ zstyle ':prezto:module:prompt' theme 'nphadke'
- Run
source .zshrc
I’ll keep tinkering with this prompt but it seems good to go for now.