tmux, the latest addition to my toolset

I happen to have this little collection of favorite tools(emacs, zsh etc) that help me use my computer better, and make me productive. For a long time i was screen user. Screen is really productive with escape sequence mapped to Ctrl+j(default is Ctrl+a which conflicts with emacs mode binding to jump to beginning of line). While screen is a great multiplexer and terrific tool for detaching and maintaining shared sessions(say fronting long running processes on remote machine etc), it doesn’t do vertical splitting which can be an important productivity boost for people using multiplexer to manage local terminal emulator sessions. Terminator is a terminal emulator thats capable of splitting both ways, but its not as powerful and usable because it doesn’t separate the concept of buffer(the text you exchange with shell bound processes and prompt) and the pane (visual real estate itself), which means it doesn’t support backgrounding(or whatever you like calling it) and doesn’t have other goodies like copy mode either(afaik).

Recently my colleague(Chris Turner) introduced me to tmux which happens to be the best terminal multiplexer i have seen till date. It not only supports vertical splitting in addition to everything else that i love screen for, but has inbuilt emacs and vi style keymaps, which means i can use emacs like shortcuts while in copy mode. In addition to that, it remembers window layout across multiple panes, even for detached sessions and that is a big advantage over screen for managing sessions on remote machine. Tmux comes with quite bare-bone default setup, but its power must not be underestimated. Here is a screenshot of what my tmux(running within gnome-terminal) looks like. I find this setup way more productive compared to its powerful predecessor screen, let alone terminal emulators like Terminator.

Here is my .tmux.conf. Feel free to use it if you like my setup(gentoo portage tree had tmux 1.1 at the time of writing this post, so this config may require some tweaking to work with older releases). I use Ctrl+j as escape sequence, as both keys are on the home row its really convenient(if you are like me, i can safely assume you have Caps lock swapped with Ctrl). Besides, it doesn’t conflict with any of the shell shortcuts that i use. As the screenshot shows, tmux is capable of being screen and a whole lot more.

I have a little function named ‘x’ added to .zshrc which helps me transfer text selected from copy mode to X session clipboard(however, you need xclip installed to use it).

x() { echo $1 | xclip -selection c. }

It took me only a few hours to configure it to my taste and discover the wonderful features that it comes packed with, thanks to the brilliant manpage entry and online help (<Excape seq> + ?). So what are you waiting for? Its time your package manager did the hard work ;-). Give it a few hours, its well worth it. Happy TMUXing!


About this entry