Viktor Kojouharov wrote:
It turned out that these mappings broke the arrow keys in the terminal:
inoremap <expr> <Esc> pumvisible()?"\<C-E>":"\<Esc>"
inoremap <expr> <CR> pumvisible()?"\<C-Y>":"\<CR>"
inoremap <expr> <Down> pumvisible()?"\<C-N>":"\<Down>"
inoremap <expr> <Up> pumvisible()?"\<C-P>":"\<Up>"
inoremap <expr> <PageDown>
pumvisible()?"\<PageDown>\<C-P>\<C-N>":"\<PageDown>"
inoremap <expr> <PageUp>
pumvisible()?"\<PageUp>\<C-P>\<C-N>":"\<PageUp>"
IMHO, if one is expecting to use vim (as opposed to gvim), mapping <Esc>
causes trouble.
That's because most terminals issue escape sequences
(<esc>..something..) when special
keys (such as the arrow keys, functions keys, etc), and that mapping of
the <esc> key
messes up the escape sequence. Besides -- how do you get out of insert
mode? I realize
one can use ctrl-o and norm!, but that seems painful. If you're not
using normal mode
or command mode, then you're missing a lot of vim.
Regards,
Chip Campbell