Getting started with tmux
As a long-time user of GNU screen, I knew it would be difficult to switch, but I’ve made the move and am so far pretty happy. tmux does all the same things that screen does, but was a lot easier to customize. I wanted to share my tmux configuration file and other things that made the switch all that much more amazing.
Keyboard bindings
I changed the default keyboard bindings to be more like screen:
- Ctrl-b? Forget that. Ctrl-a all the way.
- Ctrl-(left/right) arrow to move between windows? Hell yes.
- Ctrl-a twice to go “back”? Perfect.
- Ctrl-a, r to reload the config file made it very easy to debug.
Status bar at the bottom
I made my status bar have the session name and my machine name on the far left, the various tabs centered in the middle, and the system time and date on the far right. It was very easy to configure, and I’m guessing I’ll end up tweaking it from time to time.
Project-specific configurations (and attach tool)
Here’s the coolest part in my opinion. I forked a repository called “tat” that does some nifty things to make project-specific configurations really easy to set up consistently, and attach to them later on. Oh, and there’s tab completion for existing sessions as well as for your project directory names. Check out my fork to see the details.
With tat you can create a .tmux file in your project directory, which be run with the first argument being the session name. You can use this to configure your project workspace easily and consistently. Here’s one of my example .tmux project files.
Tab completion
Don’t forget to enable tab completion. On Ubuntu I did the following:
$ sudo curl https://raw.github.com/mithro/rcfiles/master/bash/completion/tmux > /usr/share/bash-completion/completions/tmux

