tmux Synchronized Panes

April 19, 2019

tmux can send the text you type to multiple panes:

demo of tmux synchronized panes
(screenshot source)

Even though I’ve used tmux for years, I never realized that it could do that until my colleague (thanks @laurence_man!) told me about it.

It’s similar to clusterssh without having to ssh anywhere. 😄

Call it from the tmux command line:

# toggle
:setw synchronize-panes

# or, explicit on/off
:setw synchronize-panes on
:setw synchronize-panes off

Make it easy: key binding

Having to type :setw synchronize-panes is too much work. I added this to tmux.conf:

# toggle synchronize-panes
bind C-x setw synchronize-panes

# that's prefix + ctrl-x ^^

I don’t necessarily recommend that key binding, pick something that works for you. Other people use ctrl-x (without prefix) but that conflicts with some bash/vim bindings.

Make it obvious: window status

If the panes are synchronized, I want an easy way to tell. I added this to tmux.conf:

setw -g window-status-current-format '#{?pane_synchronized,#[bg=red],}#I:#W'
setw -g window-status-format         '#{?pane_synchronized,#[bg=red],}#I:#W'

The pane_synchronized variable can be used for conditional coloring in the window status. (inspiration)

synchronized pane highlighted in red

Guess which window has synchronized panes ^

Feel free to check my tmux.conf and grab the parts you like.

Discuss on Twitter