Core Library0.xAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

method libtmux-rs latest

Pane.format

Expand a tmux format string in this pane's context.

Source and package
Qualified name
libtmux::pane::Pane::format
Module
pane
Declared in
Pane
Package
libtmux
Source
crates/libtmux/src/pane.rs
pub async fn format(&self, template: &str) -> Result< TmuxText, Error >

Description#

This returns display-message output instead of showing it in front of a person with Self::display(). See crate::Server::format() for the shell boundary around command and recursive formats, and for why a % in the template is a time conversion rather than literal text.

Errors

Returns an error when tmux cannot be reached or refuses the format.

Examples#

let guard = libtmux::test::TestServer::new().await?;
let session = guard.server().new_session("shown").await?;
let window = session.active_window().await?.expect("a window");
let pane = window.active_pane().await?.expect("a pane");
let expanded = pane.format("#{pane_id}").await?;
assert_eq!(expanded.to_string_lossy(), pane.id().to_string());
guard.shutdown().await?;
Parameters

tmux command#

The tmux commands behind format.

tmux C API#

The C declarations in tmux that implement these commands.

Esc

Type to search.

Reference previewOpen reference