Pane.swap
Swap this pane with another via $ tmux swap-pane.
Source and package
-
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 (-dflag). -
move_up(bool | None) # – Swap with the pane above (-Uflag). Mutually exclusive with target and move_down. -
move_down(bool | None) # – Swap with the pane below (-Dflag). Mutually exclusive with target and move_up. -
keep_zoom(bool | None) # – Keep the window zoomed if it was zoomed (-Zflag).
-
tmux command#
The tmux commands behind swap.
tmux C API#
The C declarations in tmux that implement these commands.
In other ports#
Exchange two panes
| Language | Equivalent |
|---|---|
| Ruby | Lib |
| Lua | libtmux |
| Erlang | tmux |
| Haskell | No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing. |
| TypeScript | pane |
| Rust | pane |
| Go | tmux |
| Java | io |
| C# | Lib |
| C++ | libtmux:: |
| Swift | Server.swap(_:with:) swaps windows, not panes |
| OCaml | Libtmux |
| Perl | No dedicated equivalent in the selected Perl surface. Explicit Server::cmd remains available for native tmux commands. |
No equivalent is recorded in PowerShell, Julia, Elixir, Common Lisp, Clojure, Kotlin, Scala or F#.