29 May 2012

Tmux, a reluctant love story

Tmux…a complicated love story.

In the beginning it was like other romance, flirt a little bit, brief moments of interaction, maybe compile from scratch and smell the roses on distant servers.

But it never really stuck. GNU Screen was quite the workhorse and I only needed it on remote servers because Terminator terminal emulator worked very well with multi-splits and session state maintenance. I had many “Oh that’s what I’ve been doing” type moments. At the time I didn’t see any great benefit to it on a local box.

I gave it another try on my recent Arch laptop because all the cool kids seemed to have a revived interest in tmux. The controls were nice, the look was nice, but it had more funky scrolling and mouse selecting issues than Terminator… so back I went. (Note: I remember having to choose my configuration between either a functional copy and paste w/ mouse or functional copy and paste with keyboard…but this is loosely based on my distant memories).

Fast forward to last night when I received a reminder about tmux. I thought, there’s probably something I’m missing. Lo and behold, the thing I’m missing is the awesome power of Slime.vim, Pry, and Terminal or Gvim (MacVIM).

Slime.vim allows you to program in your editor, then highlight a block of code to execute, mash C-c C-c (very Emacs), and have the code run in another split window (powered by Tmux). For me the code composition happens in VIM and is piped into a Pry session for execution and exploration. I foresee many more Slime/Pry/VIM sessions in my future and am excited about the fluidity of this setup.

The long and short of how to get it working, install tmux, add vimrc command telling it use tmux rather than screen, highlight and C-c x2 for execution.

Seems like a perfect workflow and I’m happy that I explored more about tmux.

Next is xmonad…. here I come (on linux boxes).