libtmux Reference MCP Search
On this page

tmux.Pane.Split

View as Markdown

Module
tmux
Declared in
Pane
Package
github.com/libtmux/libtmux-go/tmux
Source
tmux/pane_create.go
Other languages
PythonTypeScriptRustJava.NETC++Swift
Split ( ctx : context.Context , request : SplitPaneRequest ) (Pane, error)
method [source]
method [source]
Split

Split creates a tiled pane relative to the receiver's exact linked-pane view. Attach makes the new pane active in that session and winlink; it is not a global client-focus guarantee. The returned Pane is freshly materialized in the receiver SessionID and WindowID.

If tmux reports a PaneID before a transport or refresh failure, the partial result also contains the receiver SessionID and WindowID. Other failures return zero; creation is not rolled back.

In other languages Split a pane in two

Examples

>>> (pane.at_left, pane.at_right,
...  pane.at_top, pane.at_bottom)
(True, True,
True, True)
>>> new_pane = pane.split()
>>> (new_pane.at_left, new_pane.at_right,
...  new_pane.at_top, new_pane.at_bottom)
(True, True,
False, True)
>>> right_pane = pane.split(direction=PaneDirection.Right)
>>> (right_pane.at_left, right_pane.at_right,
...  right_pane.at_top, right_pane.at_bottom)
(False, True,
True, False)
>>> left_pane = pane.split(direction=PaneDirection.Left)
>>> (left_pane.at_left, left_pane.at_right,
...  left_pane.at_top, left_pane.at_bottom)
(True, False,
True, False)
>>> top_pane = pane.split(direction=PaneDirection.Above)
>>> (top_pane.at_left, top_pane.at_right,
...  top_pane.at_top, top_pane.at_bottom)
(False, False,
True, False)
>>> pane = session.new_window().active_pane
>>> top_pane = pane.split(direction=PaneDirection.Above, full_window_split=True)
>>> (top_pane.at_left, top_pane.at_right,
...  top_pane.at_top, top_pane.at_bottom)
(True, True,
True, False)
>>> bottom_pane = pane.split(
... direction=PaneDirection.Below,
... full_window_split=True)
>>> (bottom_pane.at_left, bottom_pane.at_right,
...  bottom_pane.at_top, bottom_pane.at_bottom)
(True, True,
False, True)
const created = await pane.split({ vertical: true });
created.id;
use libtmux::{PaneSize, SplitDirection, SplitOptions};

let session = server.new_session("split-from-pane").await?;
let pane = session.panes().await?.remove(0);

let above = pane
    .split(
        SplitOptions::new(SplitDirection::Above)
            .size(PaneSize::Percent(30))
            .command("sleep 300"),
    )
    .await?;

assert_ne!(above.id(), pane.id());
assert_eq!(above.window_id(), pane.window_id());

0 declared, 0 inherited

Esc

Type to search.