You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I thought I'd share this in hopes that someone finds it useful. The manual says key sequence bindings (e.g. typing abc are possible with switch-client:
bind-key -Ttable2 c list-keys
bind-key -Ttable1 b switch-client -Ttable2
bind-key -Troot a switch-client -Ttable1
This syntax is not very readable. These commands could just as well be in reversed order (the order that they'd be typed to trigger the abc sequence). Additionally, it seems we have alot of freedom when we name key tables using the -T option, so why not something like current_sequence=a or current_sequence=ab.
Here are some examples I've put together:
# tmux prefix key sequence example
# binds prefix abc
bind-key -T prefix a switch-client -T current_sequence=prefixa
bind-key -T current_sequence=prefixa b switch-client -T current_sequence=prefixab
# The final key of the sequence should use braces and indentation so that the actions are easily readable:
bind-key -T current_sequence=prefixab c {
run-shell "echo prefix abc sequence was pressed"
switch-client -T current_sequence=prefixabc
}
# sequence continuation example part 1
# binds prefix abcd (the above abc binding will get triggered before)
bind-key -T current_sequence=prefixabc d {
run-shell "echo prefix abcd sequence was pressed"
switch-client -T current_sequence=prefixabcd
}
# sequence continuation example part 2
# binds prefix abcde (the above abcd binding will get triggered before)
bind-key -T current_sequence=prefixabcd e {
run-shell "echo prefix abcde sequence was pressed"
switch-client -T current_sequence=prefixabcde
}
# tmux root key sequence example
# binds xyz
# If the root table is used (`-T root`), then the first command should be `send-keys ` followed by the key currently being pressed to prevent interference with regular typing
bind-key -T root x { send-keys x ; switch-client -T current_sequence=x }
bind-key -T current_sequence=x y { send-keys y ; switch-client -T current_sequence=xy }
bind-key -T current_sequence=xy z {
send-keys z
run-shell "echo xyz sequence was pressed"
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I thought I'd share this in hopes that someone finds it useful. The manual says key sequence bindings (e.g. typing
abc
are possible with switch-client:This syntax is not very readable. These commands could just as well be in reversed order (the order that they'd be typed to trigger the
abc
sequence). Additionally, it seems we have alot of freedom when we name key tables using the -T option, so why not something likecurrent_sequence=a
orcurrent_sequence=ab
.Here are some examples I've put together:
Hope someone finds this useful
Beta Was this translation helpful? Give feedback.
All reactions