wubo
wubo

Reputation: 41

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

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.

Upvotes: 0

Views: 1546

Answers (1)

Jason Robinson
Jason Robinson

Reputation: 945

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.

Upvotes: 1

Related Questions