Tmux keybinding to swap pane left or right

:bind-key -n C-{ select-pane -L \; swap-pane -s '!'

This should tell tmux to select the left pane, and then swap with the previously active pane.

Also, swap-pane -s {right-of} seems to work.
Here is the list of ways to refer to other panes:

{last} !       The last (previously active) pane
{next} +       The next pane by number
{previous} -   The previous pane by number
{top}          The top pane
{bottom}       The bottom pane
{left}         The leftmost pane
{right}        The rightmost pane
{top-left}     The top-left pane
{top-right}    The top-right pane
{bottom-left}  The bottom-left pane
{bottom-right} The bottom-right pane
{up-of}        The pane above the active pane
{down-of}      The pane below the active pane
{left-of}      The pane to the left of the active pane
{right-of}     The pane to the right of the active pane

See the online man page for reference.

Tags:

Tmux