server.keys.KeyBinding
Rust
- Python Unavailable
- Ruby Unavailable
- Lua Unavailable
- TypeScript Unavailable
- Rust
- Go Unavailable
- Java Unavailable
- .NET Unavailable
- C++ Unavailable
- Swift Unavailable
- Module
- server.keys
- Package
- libtmux
- Source
- crates/libtmux/src/server/keys.rs
-
One key binding, as tmux holds it.
bind-key -nis-T root, soSelf::tableanswers it. The command is the text abind-keyline in a configuration file carries, with\;between commands, and is not parsed further. That is argument syntax: as the single command stringServer::bind_keytakes,\;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-keyline renders it. - key method Return the key as tmux names it, such as
C-bor", unquoted. - note method Return the note
bind-key -Nattached, if any. - repeats method Report whether the binding repeats,
bind-key -r. - table method Return the key table, such as
prefix,rootorcopy-mode-vi.