Discussion:
[Help-bash] Slow response?
Peng Yu
2018-06-17 11:48:38 UTC
Permalink
Hi,

I have the following line in my ~/.tmux.conf

bind-key -T root C-'[' next-window

When I type C-'[', it does not switch the window instantaneously.
There is a slight delay of say less than .5 sec. Is there any set up
in tmux that can make the switch instantaneously.
--
Regards,
Peng
Dennis Williamson
2018-06-17 11:55:56 UTC
Permalink
Post by Peng Yu
Hi,
I have the following line in my ~/.tmux.conf
bind-key -T root C-'[' next-window
When I type C-'[', it does not switch the window instantaneously.
There is a slight delay of say less than .5 sec. Is there any set up
in tmux that can make the switch instantaneously.
--
Regards,
Peng
You should ask in a tmux list.
Bob Proulx
2018-06-17 19:52:28 UTC
Permalink
Post by Peng Yu
I have the following line in my ~/.tmux.conf
bind-key -T root C-'[' next-window
Control-[ is ESC. Basically you are pressing Escape when you C-[.
Post by Peng Yu
When I type C-'[', it does not switch the window instantaneously.
There is a slight delay of say less than .5 sec. Is there any set up
in tmux that can make the switch instantaneously.
As you know escape sequences are used for terminal control. An escape
sequences will look similar to "ESC [ 1 ; 31 m". When a terminal
receives ESC it won't know if it is a standalone escape character or
if it the start of an escape sequence. If the next character is
something like "ESC x" then it immediately knows it is not an escape
sequence (probably an emacs like M-x sequence) and can move to that
state machine state immediately. But if it only sees the single ESC
and then no further characters then it doesn't know. Then it waits a
short time for another character. If no other character arrives
withing the escape sequence timeout limit then it assumes it was a
single solitary escape character.

The choice of the escape sequence ESC [ anything is a good choice
because that is an unlikely sequence to hit accidentally. But not all
terminals use that escape pattern. HP used ESC and then a letter such
as 'h' where "ESC h" was the same as keypad Home. When I used HP
serial terminals and used vi I would quite often be in insert mode and
then hit ESC to exit insert mode and 'h' to move backward to go edit
something. But if I were too quick then it would be ESC h which on HP
serial terminals and hpterms is the Home keypad escape sequence. At
which point I would be abruptly flung back to the first position at
the top of the file! One needed to hit ESC and then wait that half
second for it to be interpreted as a single character and then hit h,
h, h, to move left.

Using ESC for a single command key such as next-window is probably not
a great choice. I recommend choosing a different key binding.

Bob
Greg Wooledge
2018-06-18 13:18:29 UTC
Permalink
Post by Bob Proulx
HP used ESC and then a letter such
as 'h' where "ESC h" was the same as keypad Home. When I used HP
serial terminals and used vi I would quite often be in insert mode and
then hit ESC to exit insert mode and 'h' to move backward to go edit
something. But if I were too quick then it would be ESC h which on HP
serial terminals and hpterms is the Home keypad escape sequence.
For me, it was the ibm3151 terminal, and ESC B (go to command mode, go
back to start of current Word). On the ibm3151, \EB is kcud1 (down
arrow).

It's been 20+ years, but I *think* that my workaround at the time was
to press "ESC SPACE B". The SPACE broke up the escape sequence, so
that I could press B as quickly as I wanted, instead of having to wait.

It's good to know that other people have (partly) shared my experiences!
Bob Proulx
2018-06-18 20:03:36 UTC
Permalink
Post by Greg Wooledge
For me, it was the ibm3151 terminal, and ESC B (go to command mode, go
back to start of current Word). On the ibm3151, \EB is kcud1 (down
arrow).
I have the (somewhat bad) habit of hitting 'b' with the wrong index
finger. If I were doing things according to the teachings then I
would use the left pinky finger for ESC and the left index finger for
'b'. That would make that a hard sequence for me and slow enough that
I would probably never hit the escape sequence. But I often hit 'b'
with the right index finger. C-b is always that way for example.
Therefore I would also be very likely to hit ESC b very quickly and
would almost certainly have tripped on that escape sequence too.
Post by Greg Wooledge
It's been 20+ years, but I *think* that my workaround at the time was
to press "ESC SPACE B". The SPACE broke up the escape sequence, so
that I could press B as quickly as I wanted, instead of having to wait.
Ah! The space is a good innocuous character there. In my case I
simply learned just to wait for the cursor to move to the left after
an ESC confirming that I had left insert mode before hitting the 'h'.

[[Aside: I always thought it was strange that leaving insert mode the
cursor moves left one character. If you "i ESC i ESC" repeatedly it
walks the cursor left even though the line is not changed. It needs
to do that only when entering new text on a line since the cursor is
outside the end of the line when inserting and needs to move back onto
an existing character in the line. But it does that even in the
middle of a line when there is no need to move back. I always thought
that was odd.]]
Post by Greg Wooledge
It's good to know that other people have (partly) shared my experiences!
There are still a lot of us left! It hasn't been *that* long. :-)

Bob

Loading...