I want to bind <C-h>
to execute tmux slect-window -t -1
, <C-l>
to execute tmux slect-window -t +1
in zsh, can I do it?
1 Answer
You could solve this by adding a couple of zsh functions, registering them as zle
widgets, and then use bindkey
to map them to hotkeys.
I wouldn't want to bind anything to <C-l>
though, since that's usually the keybinding for clear
, and I use that quite a lot.
This should solve your problem:
control_h() {
tmux select-window -t -1
}
zle -N control_h
bindkey "\Ch" control_h
control_l() {
tmux select-window -t +1
}
zle -N control_l
bindkey "\Cl" control_l
How to create basic keyboard shortcuts in zsh is covered here