Console Vim: Still can't get keys with <Esc> leading key-codes to work in Insert mode
I use a lot of key mappings with Meta keys, when using console vim, I have the following codes in my .vimrc file:
let char= 'a'
while char <= 'z'
exec "set <M-" . char . ">=\<Esc>" . char
let char= nr2char(1+char2nr(char))
exec "set <M-" . '.' . ">=\<Esc>" . '.'
After these settings, all the key mappings with Meta keys work seamlessly in both Normal and Command mode, but not in Insert mode, Vim acts like always interpreting those key codes as one <Escape> key followed by another key in Insert mode. Cursor keys (←↑→↓) don't work either.
I found out that I actually can make the Insert mode key mappings work, only if I explicitly set at least one mapping with the leading <Escape> key:
inoremap <Esc>m <nop>
but this isn't a solution as it will introduce ambiguity to the Escape key. Setting 'timeout' and 'timeoutlen' options in turn ain't solution either as they will void all the other key mappings with multiple key strokes.
Is there any way to work around this problem? Thanks.
I use Ubuntu 16.04 with Gnome Terminal, typing ":set term?" in my vim shows "term=xterm-256color", and below is the output of the :version command:
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.