I'm a regular tmux user, and I normally use it with set -g mouse on and vi bindings. Over time, I've noticed a behaviour that I can't easily find documentation for. Essentially, in a tmux session with multiple split panes, either right-clicking a pane or hitting <C-b>m seems to "select" that pane by inverting the bg/fg colours on the pane separator, giving the impression of a thicker border.

What's actually happening here, and how can I use this functionality?


You're "marking" a pane:

-m and -M are used to set and clear the marked pane. There is one marked pane at a time, setting a new marked pane clears the last. The marked pane is the default target for -s to join-pane, swap-pane and swap-window.

Certain actions will now target the marked pane by default. Here's a sample bash script to test with. You can execute this script from within a tmux session.

# /usr/bin/env bash
set -euo pipefail

# Make three vertically split windows with text in each.
tmux split-window -v
tmux split-window -v
tmux select-layout even-vertical
tmux send-keys -t 0 'echo pane zero' C-m
tmux send-keys -t 1 'echo pane one' C-m
tmux send-keys -t 2 'echo pane two' C-m

# You can now swap the current pane with an explicitly targeted pane. Here, we
# change pane ordering from 0-1-2 to 1-0-2, and back again.
tmux select-pane -t 0
tmux swap-pane -t 1
tmux swap-pane -t 1

# You can also swap panes by "marking" one and letting the target of the swap be
# implicit. Here, we change ordering from 0-1-2 to 1-0-2, and back again.
tmux select-pane -t 0
tmux select-pane -t 1 -m
tmux swap-pane
tmux swap-pane

For more, see tmux(1).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.