Noteworthy Dotfile Hacks

I have hundreds of files and folders in my dotfiles repo, and nearly 1000 commits—there are quite a few hidden gems buried in there that generally don’t get to see the light of day. Rather than wander aimlessly through them, let me give you the guided tour.

I often tell people “oh, and you can also go check out my dotfiles repository for more cool configurations” when I’m giving out dotfiles advice. If someone gave me this advice, I know I wouldn’t follow up, even if I had the utmost awe for the recommender. Drudging through config files isn’t all that fun, even though they can do fun things. Why not get rid of the drudgery?

This post is designed to bring the coolest parts of my dotfiles to the top. It’s organized by topic, so feel free to skip around.

Note: throughout this post, I’ll be linking to my dotfiles at a specific commit on GitHub. While this solves the problem of line-level links breaking on updates, it means that you’ll almost certainly be looking at out-dated code. Make sure to check out the corresponding file on the master branch for the most up-to-date version.

Also, I just wrote about one of my biggest dotfile hacks: using rcm to keep my dotfiles in sync across machines. Be sure to give it a read if you’re running into that problem.

tmux

I have a lot of cool stuff going on in my .tmux.conf

dircolors

I use the GNU dircolors command to change the colors output by the ls program. After running brew install coreutils on OS X, I’m able to see the colors thanks to this file and this snippet in my zshrc.

(image from the dircolors-solarized repository on GitHub)

gitconfig

I talked about this in a previous post, but I have some special settings in my global gitconfig for adding colored decoration to git log commands. Here’s a screenshot from that post:

aklog cs.cmu.edu

For my friends at CMU, I have aklog cs.cmu.edu in my ~/.zshenv, which gets run even when you log in interactively (like what happens when you scp something), so that I can copy files from my local machine to the SCS AFS space, which is useful for doing things like making handins. Note that the file linked to above is a host-specific file that only “exists” for me on Andrew machines. You can read more about my setup in my previous post.

zsh-syntax-highlighting

I use a zsh plugin to syntax highlight my commands as I type them on the command line, similar to how the fish shell does it. It does various things, like coloring the command red or green based on whether it exists, underlines filenames that exist, highlights filenames that might be misspelled in yellow, highlights built-ins like if and for in orange, etc.

Here are some examples from my setup:

Automatic Dotfile Updates

I wrote a pretty robust script that reminds me to update my dotfiles and my system regularly. All it does is remind me to check for system updates once every 24 hours, but it works so well that I had updated my system bash version before I even read about Shell Shock!

The relevant links are here for the core script that I source in my zshrc, and then the following host specific links:

Shell aliases

I’d like to think that my whole aliases.sh file is golden, but if you’re looking for some specific things I like about it, check out my git log aliases, which I wrote about here, and my chromemem alias, which I wrote about here.

Ruby Virtualenvs

I wrote about how I use Python Virtualenvs to sandbox Ruby gems, a post in which I dropped some snippets that you can use to configure virtualenvwrapper to work with Ruby projects. I actually went ahead and fed those files right into rcm, so they’ll always be available if I ever get a new laptop.

ssh

My username on every machine I ssh to for school is jezimmer, but there are countless servers I can ssh into (7 for unix.andrew.cmu.edu, 99+ for ghc*.ghc.andrew.cmu.edu, 10 for 15-213, the list goes on). These lines enable me to ssh to any of those machines with just a hostname, and the username is assumed to be jezimmer.

iTerm2

There’s not much to show for this one, but in Preferences > General of iTerm2, you can opt to load your iTerm2 preferences from a specific location. I’ve set this to /Users/jake/.dotfiles, which means that my iTerm2 settings are always written to my .dotfiles/ directory. If I ever make changes to iTerm2, they get propagated as changes that Git picks up on and which I subsequently check into Git history.

Vim

I’m in love with my Vim setup. If you’re looking for help getting started configuring Vim, you should checkout the Vim plugins workshop I put together, which gets you started with a “fully-configured” Vim setup. Once you think you’ve “mastered” that and you’re ready for more, here are a list of things I’m proud of in my .vimrc:

Other

I’ve only highlighted a fraction of my configuration files, but I think I’ve managed to capture a good portion of them. If you thought that one of these snippets was useful, are having trouble getting something to work, or have something interesting to share, leave a comment below!