After reading an article about the benefits of tmux, I have decided to give it a try.

What I find more interesting is the ability to easily setup your development environment, specially for Django when you need to run the server, the celery workers, and probably an HTTPS proxy (like stunnel) to redirect requests from external services (paypal, facebook calls…).

First steps

First of all I prefer to change the prefix key binding (the one that tells that the next keys are for tmux and not for the underlying term) to something more comfortable. I’ve found _ C-u _ easy to type, and I think it does not clash with any command that I’m currently using in Vim.

Set the prefix, and then bind the second time whe press _ C-u _ to send it to the terminal:

set -g prefix C-u
bind C-u send-prefix
unbind C-b

Also from this article about basic tmux, I like the part of remaping the keys to cycle panes.

unbind ^A
bind ^A select-pane -t :.+

We want to set the default terminal to support colors:

set -g default-terminal "screen-256color"

And for vim inside tmux, if you have any problem having color, check this tips for having 256 colors in vim. (Vim users may also want to set the ttyfast option inside tmux)

To enter copy mode C-u [ then we move around the windows. In order to get a vim-like navigation we should set:

setw -g mode-keys vi

(source: Copy & Paste in tmux ).

Look at the man page to know the basics about moving, and copy paste commands.

_ C-u z _ to toggle zoom in your actual pane is very useful if you want to focus on a panel.

Set the maximum history lines:

set history-limit 5000

Creating a tmux session for a project

You can check how to list the actual screen layout, and then save it to restore it later:

tmux select-layout 3922,317x74,0,0{200x74,0,0,3,116x74,201,0[116x36,201,0,2,116x37,201,37,1]}

Tools to manage tmux sessions

References