Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In VIM when I type a left bracket a matching right bracket is automatically added, which is fine. But if I have a line like the following:

thisVar = count(blue*(red+green)  -  orange + (1*3);

and I want to add a right bracket after (red+green) I have trouble. If I type a right-bracket VIM skips me ahead to the next right-bracket on the line. The only way I can add the right bracket seems to be to add a carriage return to split the statement over two lines, add the bracket, and then put it back:

  thisVar = count(blue*(red+green))
  -  orange + (1*3);


  thisVar = count(blue*(red+green))  -  orange + (1*3);

What configuration setting needs to change to stop VIM from jumping ahead to the next right bracket?

share|improve this question
This is behavior from a plugin. If you don't remember that, how are you gonna keep it up-to-date?! (Maybe what you see is a bug that was already fixed in a later version.) – Ingo Karkat Jan 11 '13 at 0:42
It's almost certainly a plugin, though which one I'm not sure. I guess I'll have to disable them individually to figure it out. – Hibiscus Jan 11 '13 at 22:47

Vim does not behave that way by itself. You must be using some plugin that does that. Executing the following command should show you which plugin has mapped the (.

:verbose imap (

The documentation for that plugin may tell you how to control that behavior, or you can disable the use of that plugin altogether. Where you find the documentation and how you control it depends on the plugin. You may find documentation by executing

:help <plugin name>

or by simply opening the plugin file, where the file name was given by the :verbose command above.

share|improve this answer
That's useful to know, but didn't help. In this case the bracket matching happens when in insert mode so the bracket isn't actually mapped to anything from what I can tell. – Hibiscus Jan 11 '13 at 22:47
You wrote that when you type a left bracket (actually a parenthesis), a matching right bracket is automatically added. Vim does not have a mechanism built in to do that. The only way that that can happen is if that functionality is added, usually by a plugin. The only way that a plugin can replace the normal behavior of typing some key with its own behavior is to map that key to some other key sequence. (Abbreviations are used in some cases, but that doesn't appear to be the case here.) So that left "bracket" is mapped to something--we just need to figure out what. – garyjohn Jan 11 '13 at 23:48
Vim does have a behavior where it will momentarily move the cursor to a left parenthesis when you type the matching right parenthesis, but that doesn't affect the inserted text and doesn't appear to be the behavior you're describing. – garyjohn Jan 11 '13 at 23:50
This did turn out to be a plugin issue. The HTML Auto Close Tag plugin was causing it. – Hibiscus Jan 12 '13 at 1:51
Very good! How did you determine that was it? – garyjohn Jan 12 '13 at 2:03

To added the right bracket at any position you want it to be, switch to insert mode first, by pressing i.

If vim is not in insert mode, pressing ) do move the cursor to the next right bracket.

Use Esc to exist insert mode.

PS: If the above is not the case, please post ~/.vimrc and /etc/vim/vimrc into your question.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .