On this page
pane.Pane.split
- Module
- pane
- Declared in
- Pane
- Package
- @libtmux/libtmux
- Source
- packages/libtmux/src/pane.ts
- Other languages
- PythonRustGoJava.NETC++Swift
- split ( options : : SplitOptions ) Promise<Pane>
-
Split this pane and resolve the created pane.
Examples
const created = await pane.split({ vertical: true }); created.id;In other languages Split a pane in two
Examples
const created = await pane.split({ vertical: true });
created.id; >>> (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) 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