Does Tmux supports key-bindings with key sequences like Vim does (e.g. bind-key ab kill-pane)? Or how can i emulate that?
I'm using tmux 2.3.
You can emulate key sequences by defining your own key tables and chaining them together.
For example, if I want <C-q>x
to do something, I put the binding for 'x' into a key table "my-keys", then bind the key that activates that key table with switch-client
(C-q):
bind-key -Tmy-keys x send-keys "my binding"
# Multi-key prefix for custom bindings
bind-key -Troot C-q switch-client -Tmy-keys
NOTE: I started with C-q, because it seems to conflict the least with the command line and Vim.
So, now you have every key at your disposal with a C-q prefix.
If you want more keys in your sequence, add another level of indirection:
bind-key -Tmy-keys x send-keys "my binding"
# Pane (i.e. 'W'indow commands like Vim with C-w)
bind-key -Tmy-keys-window-ctl s swap-pane
bind-key -Tmy-keys C-w switch-client -T my-keys-window-ctl
# Multi-key prefix for custom bindings
bind-key -Troot C-q switch-client -Tmy-keys
So, now I have swap-pane
bound to <C-q><C-w>s
.
This works because
<C-q>
activates "my-keys" key table,<C-w>
, s
to call swap-pane
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With