Skip to main content

Cleaning House on My dotfiles

03-19-18 Rob Tarr

A new computer, a fresh start. Rob shares how he took advantage of some housecleaning—and more—when he got his new device. Learn how you can try out some new ways to optimize your development experience.

A few months ago I was lucky enough to get a new work computer. I decided to start totally clean instead of just restoring my old computer to the new one. I feel like I’m always telling my kids to clean up after themselves and put their things away. This was my way of doing the same to my digital existence. Since almost everything I need is on Github, Dropbox, or iCloud this was fairly straight forward. One GitHub repo I knew I’d want to work with early was my dotfiles. I spend a lot of time in the terminal, it’s kind of like a second home, and dotfiles allows me to optimize my terminal workflow. So, I figured while I was doing this move, I’d make some upgrades, a fresh new coat of paint if you will. Read on if you’re looking to update your workflow—or try out some new ways to optimize your development experience.

A New Shell

The first thing I wanted to try to out was a new shell. For the last few years I’ve used ZSH with Oh My ZSH. I thought I’d try something new. I had heard that one of my co-workers had tried out Fish Shell, and starting with a clean slate seemed like the perfect time to experiment with something. It’s good to keep trying new things. So, I installed Fish Shell. I really liked the autocomplete that it came with out of the box, but it seemed like everything that I needed to setup needed some extra configuration for Fish. I probably used Fish for two months, but in the words of Rob Harr, “The Juice wasn’t worth the squeeze.” So I decided to go back to ZSH, but not to use Oh My ZSH. It does so much that I wasn’t using before, and I wanted to trim down my configuration.

I started a new branch in my dotfiles repo and started cleaning house. I removed all of the old cruft that I wasn’t using on a regular basis. Then started to update things for a new slim setup.

Things I needed in my terminal:

  • customizable prompt

  • autocomplete commands

  • text expansion of shortcuts

  • autocomplete git branches

Customizable Prompt

This was a pretty easy one. I installed Pure, and that was pretty much all I needed. I may tweak some things in the future, but the defaults are pretty awesome.

Autocomplete Commands

zsh-autosuggestions gives inline Fish-like autocomplete.

autocomplete example

Text Expansion of Shortcuts

This was one of the things that I had gotten used to in Fish. Typing an alias like gca would visually expand to git commit --amend -C HEAD. This is great, because it helps me to remember what some of those aliases are actually doing.

To get this working in ZSH, I found zsh-abbrev-alias.

Autocomplete git branches

This is one of the great things about moving away from Oh My Zsh. It exposed all of the “magic” that was happening that I took for granted. One of the things that stopped working without Oh My ZSH was alias ggpush=‘git push -u origin $(git_current_branch)’.

$git_current_branch (which gets replaced with the current branch name) is part of Oh My ZSH. To replicate this, without Oh My ZSH, I added:

function git_current_branch() {
 ref=$(git symbolic-ref HEAD)
 echo "${ref#refs/heads/}"
}

The Benefits of My Early Spring Cleaning

I’m pretty happy with my simplified config. Almost everything in my config is something that I use on almost a daily basis, and it’s all out in the open. There’s nothing magic in there that’s hiding a bunch of functionality. Having a really clear understanding of what’s in my config and where those pieces are also makes adding new plugins and custom functions very easy.

Related Content

See Everything In

Want to talk about how we can work together?

Katie can help

A portrait of Vice President of Business Development, Katie Jennings.

Katie Jennings

Vice President of Business Development