When I switched from GNU Screen to Tmux, I was just jazzed that Tmux had a status bar. To achieve that same effect in Screen I had a cryptic 115-character hardstatus string that I copy–pasted from someplace lost to the annals of the Internet Archive.

It wasn’t too long after I made the switch until I felt that old hacker itch and began scouring Github for Tmux tips.

You can view my complete tmux.conf on my github

Tmux Tips for the Uninitiated

  1. Ctrl-f Meta is for super stars

    I used to always bind Ctrl-a to Meta to make Tmux behave like Screen; however, when you use Screen inside Tmux (as I often do with our AWS servers), hitting Ctrl-a a can get pretty tiresome. Plus, you can’t use Readline very effectively without Ctrl-a

  2. Faster escape

    When I first started using Tmux I couldn’t stand the amount of time it took to enter copy-mode. Then I realized—I didn’t have to.

  3. Maximize Panes

    One of the things I love about Vim splits is that you can hit Ctrl-w | to maximize the current pane and hit Ctrl-w = to bring it back to an even split. Bringing that functionality to Tmux is very powerful and super easy. This line will let you hit Meta | to maximize a single pane and then hit Meta | again to bring it back to the original split.

    Warning: this is a tip that will only work with tmux 1.8+ (check your version via tmux -V)

  4. Vim-esque system clipboard copy–paste

    Sometimes system clipboard support from Vim isn’t enough. It’s convenient to be able to pull whatever is in your Tmux buffer onto your system clipboard (preferably without having to memorize any new keybindings and without overwriting any existing keybindings).

    First, I set the window mode-keys to use Vi bindings:

    Next, I bind Meta Esc to enter Tmux copy-mode:

    After that, I bind visual-selection and copy keys inside vi-copy mode to their Vim equivalents:

    Finally, I bind Meta y to execute a shell command. This should work on either Linux or OSX, although I’ve only tested this on OSX:

  5. OSX Specific Tmux file

    Even though Tmux and Vim are really popular on OSX—they are, essentially, broken. You have to do the whole reattach-to-user-namespace thing to get Vim’s clipboard to play nicely inside Tmux. This mess makes your tmux.conf look more cluttered and makes your dotfiles a little less portable. To fix this I keep an OSX Specific tmux.conf.

  6. Steve Losh’s Bad Wolf Status Bar

    News Flash: Steve Losh makes cool looking stuff. In Steve’s version of this he uses a small script to get his unread email count from his local offlineimap folder. In the version below I use a little bash script I wrote to grab weather info (that I call weathermajig).