How I Program — 10 Years In

5/7/2018 ☼ writing

To be an excellent programmer, you must have a set of tools and know them extremely well. I believe that if everyone was more open about their tooling and workflow, we could all learn a lot from each other. This post is an overview of the tools I use and why I use them.

The best investment is in the tools of one’s own trade.

— Benjamin Franklin

Overview

iTerm2

I spend most of my day in a terminal, so I’m going to talk about it first. I’ll go over the features I use that are specific to iTerm2 and then some important configuration.

Features

The most important feature of iTerm2 that I don’t get from the terminal app that comes with macOS is an easy way to backup and sync settings. I have multiple computers that I use daily and often change config that I want changed on all of my machines, so simple sync is really helpful.

The other really important feature of iTerm2 is the non-standard fullscreen mode. It uses the old style of fullscreen where the app isn’t put into a separate space and doesn’t have the dreaded and impossible to turn off animation between spaces that will cost you hours of your life every year.

Configuration

Probably the most important stylistic configuration of your terminal is the color scheme you use. I like solarized because of the low contrast and soft colors. I’ve used various versions of it for so long now that I find anything else to be hard on the eyes. I’m currently using the 256 color version of base16 solarized because it works well with iTerm, tmux and vim.

I currently use Input mono by David Jonathan Ross as my font. I find it very easy to read and it works really well with my preferred and very luxurious setup of 24pt on a 5k iMac. I used Inconsolata for a long time before switching to Input and still think it is a solid choice.

ZSH

I switched to zsh so long ago and always change my shell immediately on new computers. Because of this, I can’t even remember what it does on it’s own that bash doesn’t. That’s not the important part though. What matters is the really good community around zsh plugins and themes.

Prompt

I use pure prompt by the amazing Sindre Sorhus as my zsh prompt. I really like it because it’s fast, clean and shows me exactly the information that I care about, and nothing else. Seeing the current git branch and it’s status (dirty, unpushed and unpulled) is really helpful because I spend a lot of time switching between branches.

Plugins

I currently use anitbody to manage my zsh plugins, mainly because it is the fastest. I have used oh-my-zsh and antigen previously, but antibody is much faster than both.

Tmux

Tmux is something that I have only been using heavily in the last year or so. I don’t spend that much time working one things via ssh, but as I have learned, tmux is useful for so much more than that. What I love tmux for is the ability to have several sessions (think of them like tabs) going at the same time that I can quickly jump between with a fuzzy search, and are saved across system restarts. After restarting I can just restore my tmux state and switch to the session I need to work on. No making new panes, opening vim, setting up tig, starting tests, etc.

It is also worth mentioning that having a split tmux pane with vim on one side and your tests running on the other is really nice for being able to see your test results and write code without any context switching.

Plugins

There are a few important plugins and some configuration that I use to make this all possible.

Git

Git is very interesting because everyone uses it all the time, but so many people are afraid of it and don’t really know how to use it. It’s also something that seems to have a near unlimited growth curve. It amazes me that I’ve been using it every day for ten years and still learn new things monthly.

I’m not a fan of GUI git clients for a few reasons. The first is that most of my workflow is already in the terminal, so I’d rather not switch out unless I have to. The second, and more generally applicable is that I find tig combined with the git cli to be faster, simpler and far more flexible than any GUI client I have seen. Someday I will write a whole post on using tig, but the main things I like it for is good keyboard shortcuts, chunk based staging and easy history navigation.

I’m currently lucky enough to be using GitHub for work, so I use hub, which is a nice little command line wrapper for git. It adds several GitHub focused convenience methods like being able to open a pull request and quickly open important pages like issues.

Vim

This is by far the most complicated and personal part of my setup. I wouldn’t suggest starting from someone else’s setup, so I’m not going to cover everything. This is a selection of plugins and settings that have had the biggest impact on my productivity while using vim.

I plan to write a series of smaller posts, outlining specific parts of my vim setup that can easily be setup and tested in isolation.

Configuration

I’m not very good at typing and I don’t like doing it more than I have to, so a large part of my vim configuration is target at reducing it. I start by mapping leader to ; so that I can start a leader command without leaving home row. I then map all of my important actions to be a combination of leader and another home row key. For example, <leader>f opens fzf in file mode. I also use <leader> and h, j, k, l for very easy split navigation.

When I started using vim one of my biggest issues was the lack of native clipboard integration. By setting set clipboard=unnamed, your vim history is added to your system clipboard and your system clipboard is accessible from vim. I set this a long time ago and have never looked back.

Plugins

I use quite a few plugins, so I’m not going to cover them all here. This is a selection of the most useful and potentially non-obvious ones.

Dotfiles

I have been tracking my various dotfiles in a repository on GitHub for quite some time now. It doesn’t feel like a perfect solution, but it does allow for a relatively easy way to keep track of changes, sync changes between computers and setup new computers. github.com/rileytomasek/dotfiles.

Summary

If you made it this far, hopefully you learned a thing or two that will make your life easier. If you saw anything I’m doing sub-optimally or not doing at all, please let me know and I’ll give it a shot!

Thanks for reading.

✌🏻



Follow @rileytomasek — Comment on Hacker News