In a normal mode key mapping I'd like to match the ESC and only this key, not key sequences like caused by the arrow keys.
Background: I thought I'd torture myself in the process of avoiding excess ESC presses in normal mode by force-quitting vim.
My naive approach was:
:nmap <Esc> :q!<CR>
And it's actually working quite well1, except, when trying to navigate with the arrow keys in normal mode, vim quits too. I suppose it's because vim is converting the arrow keys into escape sequences internally, and then handling the
<Esc> key before the rest of the sequence.
1: on another system with some 7.4 release, vim exits on startup because something issues an escape key (sequence), probably.
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jun 21 2019 04:10:35) Included patches: 1-197, 322, 377-378, 550, 649, 651, 703, 706-707 Extra patches: 8.1.1401, 8.1.1382, 8.1.1368, 8.1.1367, 8.1.1366, 8.1.1365, 8.1.1046, 8.1.0613, 8.1.0547, 8.1.0546, 8.1.0544, 8.1.0540, 8.1.0539, 8.1.0538, 8.1.0506, 8.1.0208, 8.1.0206, 8.1.0205, 8.1.0189, 8.1.0177, 8.1.0067, 8.1.0066
(Ask for the list of included/missing features, if required.)
No plugins loaded, ensured with
I was learning via Fandom's vim key mapping tutorial and by searching this and other Stacks, so I might not have understood things well enough, yet.
How can I ignore
<Esc> in escape sequences or match a single
<Esc> or even debounce key sequences?