Most of my work day is spent in the terminal. I’m running tmux all the time and I couldn’t do without it. In this post, I present my development session setup. A session being a tmux session. If you’re unfamiliar with tmux: Go read about it, use it, learn it and come back a couple of months from now. Tmux makes your terminal work flows so incredibly powerful you’re not gonna believe it. I can wait for you.

Assuming, you know about tmux, you may have heard about Tmuxinator. This tools lets you handle (predefine) tmux sessions easily. There are a couple of tmux session managers, I just happen to use Tmuxinator. In Tmuxinator, one defines a session (windows, panes, layouts, commands to be executed, etc.) in a yaml file. With a single command (mux start <session_name>), the whole session gets created and you’re ready to work!

My tmux dev session

You see my dev session’s first window above. The Tmuxinator defintion looks like this:

# ~/.tmuxinator/dev.yml

name: dev # the tmux session's name
root: /path/to/repo # path to the root dir for all panes

# Definition of all windows. Each window has a name, potentially a layout and
# one or more panes. Each pane runs none or one command.
  - git:
      layout: tiled
        - wtig
        - htop
        - git status
        - ls
  - mgmnt:
      layout: tiled
        - ranger
        - $EDITOR ~/.alias.local
  - edit:
      layout: main-vertical
        - $EDITOR
  - exec:
      layout: tiled
  - scratch:
      layout: tiled
        - ipython
        - irb
        - ghci
        - bc
  - ssh:
        - ssh $USER@machine1
        - ssh $USER@machine2


The name and root entries are self-explanatory. The rest of the file contains the windows & pane definitions. Let me explain the different windows one by one.

My first window, git, is obviously for version control. It has four panes. Three are used for Git, the remaining runs htop just for fun. I guess the only special thing about it might be wtig.

The mgmnt window is for management. I switch to this window when I do work that has nothing to do with the current task at hand. For example, I’d install software from there, update my dotfiles or walk around the system with ranger.

The management window

The 3rd and 4th window are for real work. This is where the edit-(compile-)run cycle takes place. The editor runs in full screen mode in window 3. I have multiple panes in exec to run a script and the test and another script etc.

The scratch window is for testing some code interactively. I usually also have a calendar or bc running there.

After the 5th window, things change continuously. In the example above, I have a couple of machines where I want to have at least one login opened at session startup. It could also be a window with log files or whatever. Everything after window 5 is very task-specific. Of course, I also often open new windows with prefix + c (tmux) for new stuff.

There is no particular reason for the order of the windows. The setup evolved over time. Previously, I had an extra tmux session for management but that turned out to be more laborious (switching between sessions) than helpful.

A couple of hints further improvements:

  • Use set -g base-index 1 and set -g pane-base-index 1 in your tmux.conf to omit zero-based window and pane names. It’ll make switching between the first and second window easier (look at the position of the 0 key at your keyboard)
  • Always keep updating your configurations. I change mine at lease once a week.
  • You can directly run a command once you ssh’d to a machine.
  • Use tmux list-windows to save a specific window layout in a Tmuxinator session.