Terminal is one of my most used apps throughout the day. I wanted to customize it so that I could decrease the amount of time I was interacting with the command line. This is a quick setup guide on how I made my CLI best fit into my workflow.
This is the first window I see when I open my terminal:
And when I’m working on a project:
iTerm 2
Coming from Hyper.js, I recently made the switch to the more robust iTerm and couldn’t be happier. iTerm’s configurability makes it easier to fine-tune your workflow and offers more functionality. There is also a noticeable speed difference, as iTerm is a native app rather than an Electron app, like Hyper.
Dracula Theme
I use the theme Dracula, which is a colorful but not overwhelming theme. Its subtle color palette makes it great for syntax highlighting. More so, its availability for many different applications allows me to keep a consistent theme across my computer.
Fonts
My shell prompt uses icons, such as git, and so my font must be a nerd font. These are fonts that support programming ligatures, or in other words, have the icons as a character. I typically switch between SF Mono Powerline and Fira Code. Both of them are clean, easy to read, and fit in well with my terminal.
Status Bar
iTerm has this neat feature called the status bar. It’s a floating bar above your terminal which displays persistent information such as battery, RAM usage, and CPU usage. Its unobtrusive, and the color scheme makes the terminal even more beautiful.
Natural Text Editing
Out of the box, iTerm can be a little more restrictive in how you can interact with the prompt. A quick settings change allows you to interact with the text naturally, enabling your standard jump-to short cuts like in other applications. All you have to do is select the natural text editing preset.
Zsh Shell
The first thing I did when setting up my terminal was to install the Zsh shell. As of macOS Catalina, zsh is now the default shell.
This is my favorite shell to use, and I pair it with the Oh My Zsh framework to manage zsh. One of my favorite things about Oh My Zsh is the shortcuts for the commands I run every day. For example, instead of git commit -m
you can run gcmsg
. There’s a full list of these shortcuts in this cheatsheet. I use these shortcuts hundreds of times a day, which saves me a lot of typing.
Zsh Theme + Plugins
Starship
My Zsh prompt of choice is Starship. It is much faster than the prompt I previously used, Spaceship, thanks to being built in Rust. In the benchmark tests I ran, Starship had a 39.53ms latency compared to Spaceship’s 131.46ms. I noticed the increased speed off the bat.
I find this style prompt to be a lot cleaner and nicer to use than the popular Agnoster theme. Agnoster uses large blocks of color on the screen, which takes up a lot of visual space and looks less refined than the text-based prompt.
Syntax Highlighting
One of the first plugins I installed was zsh-syntax-highlighting, which adds syntax highlighting to your prompt. This way, its quick to tell if a certain command is available, or if you’ve made a typo.
Autosuggestions
zsh-autosuggestions is a plugin which will use previous commands to predict the next command. This is non-intrusive – to autocomplete the prediction, press the right arrow key . It’s a great feature when you’re repeating a lot of the same commands, and you don’t want to go through the recently used command list.
I use the ‘->’ key to fill the autocomplete without execution, and Control
+Space
for fill and execution. You can change the setting using bindkey
in terminal, like so:
bindkey '^ ' autosuggest-execute
Aliasing
One of the features that I leverage the most is the the ability to alias commands. I use this to alias shorter commands for longer ones. They’ve made my life a lot easier for a couple of reasons.
The first is the ability to jump from project to project in a single command. I do this by aliasing a cd command to the absolute path. For example, I alias 440
to jump to my CS 440 class directory, or ymca
for my Hack4Impact project. That way, no matter where I am, I will go straight to that directory.
Another thing that I use a lot is o
for open .
to open in Finder, and c
for code .
to open in VSCode. This is a small tip I use to minimize the time for context switching in my development process.