Vim esckeys
ksjoberg.com
Vim esckeys
1–10 of 15 posts
Re: Vim esckeys
#2For those that still want arrow keys in insert mode (sacrilege! ... but I do), this is probably the .vimrc option you want:
set timeout timeoutlen=1000 ttimeoutlen=100Re: Vim esckeys
#3I'd wondered why hitting 'O' after hitting escape led to such a nasty delay when running vim in a terminal. Now I know. For those that still want arrow keys in insert mode (sacrilege! ... but I do), this is probably the .vimrc option you want: set timeout timeoutlen=1000 ttimeoutlen=100
Re: Vim esckeys
#4Re: Vim esckeys
#5The leads back to the very old days of serial terminals and the horrible ^[ prefix in many terminal's function and arrow keys. I remember fondly working with Wyse60's and some other terminals that used ^A instead.
Imagine trying to detect ^[{randomDelay}O{randomDelay}C -vs- the user typing ^[{randomDelay}O
The Wyse60 used left=^H, right=^L, up=^K, down=^J so there was no need for the delay to detect the sequence.
Back in the old days Vi would detect this lack of multi-character function keys and not use a delay.
On a 1200 baud modem it was very nice however later as DEC and ANSI multi-byte sequences became more popular this became much more painful.
See: http://en.wikipedia.org/wiki/Termcap for more terminal insanity fun.
On a fun note, I have a customer with a 1987's era copy of Microsoft Excel for Xenix (yes it really existed).
Each time we upgraded their system to a more powerful cpu I had to patch the binary as it literally used a spin loop to delay long enough to detect the keys (never mind tty settings can help with that at kernel level). The last time I had to make it work on a recent core I literally set the "spin loop counter" in the millions to get it to work via telnet on a local network where they keys come fast and low latency!
It took me a couple hours the first time with a debugger to find this little gem, so I have a README in the binary's lib dir that explains how to update it. Every couple of years I have to dig in and figure out the right value! Fun!
EDIT: It's possible the magic was actually happening in termcap with the original vi. I didn't dig into the source to verify. :)
Re: Vim esckeys
#6Re: Vim esckeys
#7Re: Vim esckeys
#8Having remapped my caplocks key to be escape, I find myself using it fairly often not just with vim but in all sorts of ways. Considering I never used it as caplocks before except accidentally I found the remapping a good investment.
Re: Vim esckeys
#9Re: Vim esckeys
#10Having remapped my caplocks key to be escape, I find myself using it fairly often not just with vim but in all sorts of ways. Considering I never used it as caplocks before except accidentally I found the remapping a good investment.