Binding a command in tmux without using the prefix key

gnu-screenkeyboard shortcutsterminaltmux

Is it possible to bind a tmux command to a key combination and use it directly without first pressing the prefix?

I find C-b + n too cumbersome to switch panes, so I was wondering whether I could bind C-1 for example, to switch to pane #1.

Or perhaps there may be a way to make the shortcut in the terminal emulator to send C-b + 1 when I press C-1?


Best Answer

For your example, use:

bind-key -n C-1 select-pane -t 1

The -n argument is used to bind-key, it means no prefix.