How to let vim stay in insert mode by pressing Alt - h to move to insert mode?

advertisements

In order to edit fast in insert mode, we can use mapping keys to navigate in insert mode, for example

:inoremap <A-h> <Left>

with this mapping, user can press Alt + h in insert mode to let the cursor move left and then do insert, we don't need to exit edit mode, then move cursor. this will save some time for us, my question is when I use this mapping key, the cursor moves correctly, but vim switch to normal move after moving, it should keep in insert mode, I use vim 7.3 in Sun OS. I tried this in gvim 7.3 on windows, everything is good, so I wondered is there anything i lost?


First of all: if you think navigation in insert mode is speeding up your vim, you're using it wrong (i.e. like any other non-modal editor, when its biggest benefit is specifically modality).

That said, we can't say too much without you showing us your mapping. I suspect it is something like this:

inoremap <M-H> <Esc>h

Try changing to

inoremap <M-H> <C-O>h