Core LibrarystableAPI Reference

Choose documentation 3

stable

Current version

stable
English

Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

Python API

method libtmux stable

Pane.swap

Swap this pane with another via $ tmux swap-pane.

Source and package
Qualified name
libtmux.Pane.swap
Module
libtmux
Declared in
Pane
Package
libtmux
Source
src/libtmux/pane.py
Other languages
PowerShell Julia RubyLuaTypeScriptRustGoJavaC#C++ Swift Kotlin Scala F#
swap ( self, target: str | Pane | None = None, detach: bool | None = None, move_up: bool | None = None, move_down: bool | None = None, keep_zoom: bool | None = None, ) → None

Examples#

>>> pane1 = window.active_pane
>>> pane2 = window.split()
>>> pane1_id, pane2_id = pane1.pane_id, pane2.pane_id
>>> pane1.swap(pane2)
>>> pane1.refresh()
>>> pane2.refresh()
Parameters
  • target (str | Pane | None) # – Target pane to swap with. Can be a pane ID string or Pane object. Mutually exclusive with move_up / move_down. Now optional; required only when move_up / move_down are not set. Versionchanged: 0.56

  • detach (bool | None) # – Do not change the active pane (-d flag).

  • move_up (bool | None) # – Swap with the pane above (-U flag). Mutually exclusive with target and move_down.

  • move_down (bool | None) # – Swap with the pane below (-D flag). Mutually exclusive with target and move_up.

  • keep_zoom (bool | None) # – Keep the window zoomed if it was zoomed (-Z flag).

tmux command swap-pane

In other ports Exchange two panes
Esc

Type to search.

Reference preview Open reference