tmux: Why I need to unbind the [ key before bind the Escape key to copy-mode

1.3k Views Asked by At

I want to bind Escape key to copy-mode, so I add this to the tmux conf file:

bind Escape copy-mode

but it doesn't work, unless I unbind the [ key first:

unbind [

bind Escape copy-mode

this works. But why? Why I can't leave Prefix+[ as another way to enter copy mode?

Thanks.

1

There are 1 best solutions below

0
On

In my limited opinion and knowledge, this is more so to resolve any potential conflicts with terminals. As described in the Terminal Type Descriptions Source File (termcap), Escape is defined as ^[ ( Ctrl-[ ). So it could be interpreted as ^[-[. The keys Escape and [ are also used in combination as well.

Excerpts from termcap:

In Cursor Mode, the cursor keys transmit "Esc [ {code}" sequences, conforming to ANSI standards.

...

Control Sequence Introducer is the two characters "Escape ["

I will gladly take any corrections, as this will help not only me, but also any other curious passerby's in the future.

P.S.: Those excerpts were taken from my OpenBSD 5.9 /usr/share/misc/termcap file.