In Vim, when I'm programming, I often want Ctrl-N to behave as if -
were part of a keyword; in other words, have it included in iskeyword
. However, I'd like to create a new keymapping for this and have Ctrl-N keep it's existing behavior.
I've tried this:
inoremap <C-B> <C-O>:set iskeyword+=-<CR><C-N>
... which sort of works, but the iskeyword option includes the extra -
afterward, which isn't desired behavior.
This also sort of works:
inoremap <C-B> <C-O>:set iskeyword+=-<CR><C-N><C-O>:set iskeyword-=-<CR>
... but the pop-up menu is killed by the <C-O>
.
Is there a way I can have my cake and eat it? Have the pop-up menu from appear and remain in place, but also set iskeyword
back to what it was afterward?
Alternatively, is there another way of solving this problem?