Vim move cursor one character in insert mode without arrow keys

Posted by bolov on Super User See other posts from Super User or by bolov
Published on 2014-08-24T10:26:40Z Indexed on 2014/08/25 4:24 UTC
Read the original article Hit count: 188

Filed under:

This might seem a little too overboard, but I switched to vim and I so happy about the workflow now. I try to discipline myself not to use the arrow keys, as keeping the hands on the alfa-keys all the time is such a big thing when writing. So when I need to navigate I get out of insert mode, move in normal mode and get back in insert mode.

There is an exception where this is actually more disrupting: I use clang complete with snippets and super tab which is great. Except every time I get a function auto completed after I fill in the parameters I am left with the cursor before ) so to continue I have to move the cursor one character to the right. As you can imagine this happens very often.

The only options I have (as far as I know) are : Escla or ?, and I am not happy about neither of them. The first one makes me hit 3 keys for just a simple 1 character cursor move, the second one makes me move my hand to the arrow keys. A third option would be to map CTRL-L or smth to ?.

So what is the best way of doing this?


//snippets (clang complete + supertab):
foo($`param1`, $`param2`)

//after completion:
foo(var1, var2|)
              ^ ^
              | |
     I am here  |
                 Need to be here

| denotes cursor position

© Super User or respective owner

Related posts about vim