31

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?

1 Answer 1

27

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).

2
  • This is an interesting example but has problems and it dos not really answer the question. For example if you manually open a number of panes and in each ssh into some other server or user account any TMUX command will fall on deaf ears because there is no IPC between ssh sessions. Commented Feb 13, 2020 at 14:39
  • Note that as of tmux 3.0 right clicking in tmux opens a contextual menu, which allows to do common pane manipulation actions rapidly, including marking. Commented May 20, 2020 at 23:39

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.