3

I have the following in my tmux.conf

# Ctrl - t or t new window
unbind t
unbind C-t
bind-key t new-window
bind-key C-t new-window

But these commands just work if I prefix them with my leader key. How can I bind keys in tmux without need to use the leader key before?

1
  • ... how would you type a t as start of a command? You need the prefix to tell tmux to listen to the next keystroke.
    – Panki
    Dec 18, 2020 at 12:24

1 Answer 1

5

man tmux:

bind-key [-nr] [-N note] [-T key-table] key command [arguments]
Bind key key to command. Keys are bound in a key table. By default (without -T), the key is bound in the prefix key table. This table is used for keys pressed after the prefix key (for example, by default 'c' is bound to new-window in the prefix table, so 'C-b c' creates a new window). The root table is used for keys pressed with- out the prefix key: binding 'c' to new-window in the root table (not recommended) means a plain 'c' will create a new window. -n is an alias for -T root. Keys may also be bound in custom key tables and the switch-client -T command used to switch to them from a key binding. The -r flag indicates this key may repeat, see the repeat-time option. -N attaches a note to the key (shown with list-keys -N).

TL;DR: bind-key -n C-t new-window

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .