On this page
pane.Pane.split
- Module
- pane
- Declared in
- Pane
- Package
- libtmux
- Source
- crates/libtmux/src/pane.rs
- Other languages
- PythonTypeScriptGoJava.NETC++Swift
-
Split this pane, putting a new one beside it.
Window::splitdivides whichever pane is active; this divides the one you name, which is what building a layout needs.Errors
Returns an error when tmux refuses the split, which includes a pane too small to divide.
Examples
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());In other languages Split a pane in two
- Python
libtmux.Pane.split - TypeScript
pane.Pane.split - Go
tmux.Pane.Split - Java
io.github.libtmux.Pane.Pane.split - .NET
LibTmux.Pane.SplitAsync - C++
libtmux::Window::split - Swift
Server.split(_:direction:size:startDirectory:)
- Python
Examples
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()); >>> (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; 0 declared, 0 inherited