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

  • With similar problem, I ended up hacking on completion script in order to make it just not echo closing ) if there is at least one argument in the function. So I type it by hand. Much more useful now. Aug 24, 2014 at 13:11
  • What happens when you type ) I bet it skips over with out actually inserting. (I don't use this plugin)
    – FDinoff
    Aug 24, 2014 at 20:13
  • @FDinoff no, it just inserts another )
    – bolov
    Aug 24, 2014 at 20:14
  • 1
    @bolov thats disappointing. You might be able to extract the code which does that from auto-pairs. I have no idea if the plugins will conflict they might. The other option is to use <C-O>l to exit to normal mode for 1 normal mode command.
    – FDinoff
    Aug 24, 2014 at 20:16

4 Answers 4


Map ) to skip over the exisiting ) if it is a closing parenthesis

inoremap <expr> )  strpart(getline('.'), col('.')-1, 1) == ")" ? "\<Right>" : ")"

Taken from: http://vim.wikia.com/wiki/Automatically_append_closing_characters

Old Answer

:h i_CTRL-O execute one command, return to Insert mode.

Ctrl-ol will move you one character to the right then return you to insert mode.

Alternatively some of the bracket plugins allow you to just type the closing bracket ) and they will override the existing one.

  • 1
    this doesn’t work if ) is the last character on the line (and this happens often as you write code). CTRL-O a however does work. So I guess we saved one key. :)
    – bolov
    Aug 24, 2014 at 21:07
  • True del ) is only two characters and will always put you after the closing parenthesis.
    – Brett Y
    Aug 24, 2014 at 21:14
  • skipping over the ')' works like a charm, thank you
    – bolov
    Aug 26, 2014 at 8:20

Type the following to find the control keys that are used in insert mode.

:help insert-index

ctrl-b is not used, but you may want to sacrifice some other key.

imap <c-b> <right>

This works to move the cursor right one char. Or map some double char.

imap jj <right>

Use ctrl-f to move one character to the right, in insert mode.

This works on my mac in general. There are other such commands using ctrl, but they might not always work. Eg ctrl-b brings you back one character in my vim insert mode and on my Mac, except when I am editing something inside a stackoverflow answer, in which case it is mapped to making text bold :)


Seems to be ctrl-f can skip a character. Try that first,


You can type the character one more time for auto completion.

foo(var1, var2|)
              ^ ^
              | |
     I am here  |
                 Need to be here

In your chart, just type ), this will make you confirm the last character and then move on. I understand this is not exactly what's asked for, but so far i can see this is very easy and bullet proof.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.