Holistic Engineering

A random assortment of shit with sprinkles.

How Tmux and Lion Full Screen Make My Life Better

| Comments

I had a “huzzah” moment about a week ago where I really tried to drink the OS X kool-aid, and was marginally successful. Here’s how I did it.

My goal was to minimize distractions… something that comes pretty commonplace with being an ops guy, supporting developers and watching a pager, and lots of other things. I will freely admit to not handling distractions as well as I should, but I do work best when I can just focus in on something and get it done, so I seek to improve that situation when a solution presents itself.

My previous solution was pretty simple, I came back to OS X from Linux with (good) tiling window managers such as wmii and configurability suites like rumai. (If you’re on linux and are interested in these tools, I strongly suggest checking out subtle instead… they have gone a long way towards improving a lot of the warts wmii has.) Anyhow, I started using a tool called sizeup which is more-or-less like a manual tiling window manager for OS X. There are others, like divvy and tyler that perform similar functions.

About 3 weeks ago iTerm2 released tmux “integration”. This requires a separate build of tmux provided by the iTerm guys (located here), and provides gui-level integration with tmux window splitting and friends, along with all the features of attachment & detachment that screen, dtach, and tmux fans revel in.

This, and some comments by a co-worker (hi, Michael!) praising tmux’s worth got me intrigued. I also wanted to try the full-screen support in Lion and start using virtual desktops again as my inability to keep on task with SizeUp was starting to become a serious productivity drain. I don’t know about anyone reading this, but I get immensely frustrated when I’ve been sitting in a chair for hours and have nothing to show for it. :)

So I tried tmux by itself; it turns out that iTerm stuff is mostly fluff and not particularly useful (to me, at least) and with all the effort required to get a separate build going it’s much easier to walk away with brew install tmux and forget about it.

So let’s get to the point. Here’s my vim as screencapped earlier when I started writing this thing:

Vim in Full Screen

(Click on the image to see it in full glory.)

This is MacVim. Notice the distinct lack of anything but the meat of the matter; the code?

Note that you will have trouble starting macvim with -r (or --remote) this way. You will want to create an alias like this:

alias ov='open -a MacVim'

To start your MacVim process. If you don’t do this, mvim -r or mvim from inside tmux won’t allow you it to integrate with the Mac Clipboard properly. This is a known bug related to login shells.

My terms look a bit like this:

iTerm 2 and tmux in Full Screen

I use two bits here that are really important:

An alias:

alias t="tmux attach"

that saves me typing, and the below tmux configuration:

set-window-option -g mode-keys vi
set-option -g status off
set-option -g default-shell /bin/zsh
set-option -g prefix C-f
set-option -g prefix2 C-b
bind-key f last-pane
bind-key C-f select-pane -t :.+
new-session
split-window -h
split-window -v

That performs all the splits and window configuration on the first run, along with rebinding some keys that tmux binds to be really annoying. If tmux is already running, it just attaches me to the existing one.

To get mission control to work the way I wish, I make as many windows full screen as possible, and I use this configuration:

Mission Control Set Up

Then I navigate through windows with cmd+tab and ctrl+left/right for quicker switching and sub-application switching.

Additionally, I keep a “slurry” desktop for all those extra things that might not make sense to keep full screen or simply don’t play nicely with the paradigm. Adium, Twitter, etc. This actually turns out to be around 3-4 apps at any given time.

I don’t really use the mouse but this is an overview of what everything looks like at-a-glance, from the ctrl+up feature that Mission Control provides:

Desktop Overview

Comments