I'm trying to get a more sublime/atom-esq feeling when using vim. One of the things I've set up is neocomplete to mimic the other editor's autocomplete behavior.
I wanted the <ESC> key to close a completion popup if one were open, or behave normally otherwise. I came up with this solution:
inoremap <expr><ESC> pumvisible() ? neocomplete#cancel_popup() : "\<ESC>"
This seems to work fine (ESC behaves as one might expect), but it appears to break nocompatible - the arrow keys no longer work as expected in insert mode, they insert A/B/C/D and then a newline (depending on which key I hit).
Adding set nocompatible after the aforementioned line doesn't do anything (I've already got it set in the first couple lines of my vimrc), and typing :set nocompatible at runtime has no effect. The only way to fix this is by removing the remapping.
Why does this happen? How can I fix it?