Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

server.keys.KeyBinding

Rust
  • Python Unavailable
  • Ruby Unavailable
  • Lua Unavailable
  • TypeScript Unavailable
  • Rust
  • Go Unavailable
  • Java Unavailable
  • .NET Unavailable
  • C++ Unavailable
  • Swift Unavailable

View as Markdown

Module
server.keys
Package
libtmux
Source
crates/libtmux/src/server/keys.rs
struct server.keys.KeyBinding
structoverload [source]
structoverload [source]
struct server.keys.KeyBinding

One key binding, as tmux holds it.

bind-key -n is -T root, so Self::table answers it. The command is the text a bind-key line in a configuration file carries, with \; between commands, and is not parsed further. That is argument syntax: as the single command string Server::bind_key takes, \; is a literal semicolon rather than a separator.

Examples

let guard = libtmux::test::TestServer::new().await?;
let server = guard.server();
server.bind_key("prefix", "Y", "display-message hello").await?;
let version = server.capabilities().await?.tmux_version().clone();
if version.has_behavior(&libtmux::since::LIST_KEYS_FORMAT) {
let bindings = server.typed_key_bindings(Some("prefix")).await?;
let bound = bindings
.iter()
.find(|binding| binding.key() == "Y")
.ok_or("the binding is listed")?;
assert_eq!(bound.command(), "display-message hello");
assert!(!bound.repeats());
assert_eq!(bound.note(), None);
}
guard.shutdown().await?;

5 declared, 0 inherited

Members

  • command method Return the bound command list, as a bind-key line renders it.
  • key method Return the key as tmux names it, such as C-b or ", unquoted.
  • note method Return the note bind-key -N attached, if any.
  • repeats method Report whether the binding repeats, bind-key -r.
  • table method Return the key table, such as prefix, root or copy-mode-vi.
Esc

Type to search.