You may have heard the news, but last week I started a new job at Pinterest 📌!
That’s not what this post is about, but it’s related because I had to set up my new Macbook. I had to remember everything I did 2 years ago to set up my last one, plus add in a few more new things I wanted to try.
This post is about sharing how I set up my terminal and commands you may not know about that you might find useful.
Previously I wrote the Top 7 workflow tips I wish I knew sooner. It covered my terminal setup at a high-level along with other tools I use, but this article will be a full deep-dive into purely my terminal setup and what you might find valuable.
To highlight the importance of optimizing the things you use on a daily basis, here’s a formula that shows 1 hour/day efficiency gain = 1 month saved per year.
1 hour per day x 5 days per week x 52 weeks = 260 hours saved per year
260 hours / 8 hours per day = 32.5 work days per year.
So if any combination of the tips in this article can save you 1 hour, or close to it, you can get a full month of working hours back this year!
⭐️ What we’ll cover
Terminal app, shell, and plugin manager
Theming
Best terminal plugins
Aliases and history config
Command line utilities to install
Let’s dive in 🚀
💻 iTerm2 + zsh + oh-my-zsh
Install iTerm2. This terminal application allows much more customization than the default Terminal application that comes with Mac’s.
Use `zsh` instead of `bash`. `zsh` is a replacement for `bash`, which is the type of shell you use.
You can run `echo $SHELL` in your terminal and you should see `/bin/zsh` if you’re using zsh. It’s roughly a superset of what bash provides, and allows you to integrate into a plugin system, `oh-my-zsh`.
Install oh-my-zsh. This is the plugin manager that allows you to easily optimize your zsh config in `.zshrc`. For example, further down, we’ll discuss plugins that allow you to easily auto-complete past commands you’ve typed, saving you hours of typing time.
How to install: `sh -c "$(curl -fsSL https://install.ohmyz.sh/)"`
Note: Running the install command overwrites your existing .zshrc file. You can access your old .zshrc file and copy any configuration over through .zshrc.pre-oh-my-zsh
🎨 Theming
Install material design colors into iTerm2
Here are the steps to get it. The TLDR is: Clone the repo, then import the `material-design-colors.itermcolors` file into iTerm2 as a color preset.
The theme colors you get look sleek like this:
Starship → Used to customize the terminal prompt like this:
To get it to look like this, I use the following config:
// ~/.config/starship.toml
format = "$directory$character$git_branch$git_status"
add_newline=false
[git_status]
stashed = ''
It results in a simple prompt of the directory, followed by the branch, followed by the git status.
There are plenty of other options you may be interested in too. Check out all of them.
Finally, you may be interested in some of the presets available to make it easier.
🔌 Plugins
Earlier, we installed the plugin manager `oh-my-zsh`.
Below, we’ll discuss my favorite plugins. You can find most plugins here.
git - The git plugin adds aliases for git commands. A few that I use are:
ga => git add
gc => git commit
gd => git diff
gst => git status
gps => git push
gpl => git pull
zsh-autosuggestions - This prepopulates your current prompt with the closest past command you entered, allowing you to hit “right arrow” to automatically finish and dramatically reduce your typing. Its essentially Github Copilot for your terminal. It’s a must have.
zsh-syntax-highlighting - Highlights the commands you type to tell you if its valid or not. For example, `brew` will be red if homebrew isn’t installed, but it will be green if `brew` is installed as you type it.
zsh-completions - This adds additional “completions”, essentially allowing you to hit “tab” to more accurately finish the command you are typing.
SCM Breeze for numbered git shortcuts
SCM Breeze isn’t an oh-my-zsh plugin, but you can install it easily.
You can refer to your files like `git add 2-3` now or `git reset 1`
See the example below: