# pane.Pane.swapWith

- **Module:** pane
- **Package:** libtmux
- **Language:** TypeScript
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-ts/blob/073b9d7dedad900bff6f5ec0ea47794e40225870/packages/libtmux/src/pane.ts#L497
- **Page:** https://libtmux.org/en/ts/latest/reference/pane-pane-swapwith/

```
swapWith(other: Pane): Promise<void>
```

Exchange positions with another pane.

## Examples

```ts
await pane.swapWith(otherPane);
```

## Parameters

- `other` (`Pane`)

## tmux command

The tmux commands behind `swapWith`.

- [`swap-pane`](/en/tmux/latest/manual/swap-pane/)

## tmux C API

The C declarations in tmux that implement these commands.

- [`cmd_swap_pane_entry`](/en/tmux/latest/reference/c-variable-cmd_swap_pane_entry/) (attribute)
- [`cmd_swap_pane_exec`](/en/tmux/latest/reference/c-function-cmd-swap-pane-c-cmd_swap_pane_exec/) (function)

## In other ports

Exchange two panes

| Language | Equivalent |
| --- | --- |
| Python | [`libtmux.Pane.swap`](/en/py/latest/reference/libtmux-pane-swap/) (method) |
| Ruby | [`LibTmux::Pane#swap`](/en/ruby/latest/reference/libtmux-pane-swap/) (method) |
| Lua | [`libtmux.Pane:swap`](/en/lua/latest/reference/libtmux-pane-swap/) (method) |
| Rust | [`pane.Pane.swap_with`](/en/rs/latest/reference/pane-pane-swap_with/) (method) |
| Go | [`tmux.Pane.Swap`](/en/go/latest/reference/tmux-pane-swap/) (method) |
| Java | [`io.github.libtmux.Pane.swapWith`](/en/java/latest/reference/io-github-libtmux-pane-pane-swapwith/) (method) |
| C# | [`LibTmux.Pane.SwapAsync`](/en/csharp/latest/reference/libtmux-pane-swapasync/) (method) |
| C++ | [`libtmux::Pane::swap_with`](/en/cxx/latest/reference/libtmux-pane-swap_with/) (method) |
| Swift | `Server.swap(_:with:)` swaps windows, not panes |

No equivalent is recorded in PowerShell, Julia, Elixir, Kotlin, Scala or F#.
