Alexey I. Froloff wrote:
* Bram Moolenaar <Bram@> [061022 14:27]:
How do you distinguish between someone typing "<Esc> key" and
"<Esc> key" generated by Alt+key?
I don't.  No program can do that, as Tony mentioned earlier.
bash (readline) for example:

M-b - backward-word

Alt+b and <Esc>b works both the same, if Alt+Key sends <Esc>Key
sequence.  Consider this as a feature.

With 'em' unset Vim behaves like every console application.


I should qualify what I said before: if you have 'ttimeout' (or 'timeout') on, and 'ttimeoutlen' set to a well-chosen positive value (longer than the delay between successive bytes added by the keyboard interface for a single keypress, but shorter than your usual typing speed), Vim will be able to determine that <Esc> <key> was typed-in rather than <M-key>, by means of the timeout: let's say you have ":set ttimeout ttimeoutlen=100" then if the delay between the Esc byte and the next one is > 0.1s Vim will see it as Escape + something, not Meta-something. (By default, 'ttimeoutlen' is negative, meaning that the same, relatively long timeout applies for both special keys and mappings.)

What I said before still applies in the case of key combinations which send a single byte (e.g. Meta-is-high-bit), because in that case there is no timeout.


Best regards,
Tony.

Reply via email to