tags:

views:

320

answers:

3

Are there any shortcuts to move to the next enclosing brackets. For ex:

int func()
{

 if(true)
 {//this point

   for(int i=0;i<10;i++)
   {//need to jump from here to

    //blah blah blah

   }

 }
}

I can move to the beginning of a function using [[ but not sure how to move to the next enclosing brackets. Thanks for any info...

+1  A: 

Put the cursor on one bracket and hit the percent key.

Also setting the 'showmatch' option makes the cursor jump to the matching opening bracket when you type the closing bracket.

Adding a declaration like this:

set matchpairs+=<:>

Will add angle brackets to the standard list of match pair brackets.

Rob Wells
+4  A: 

Can't think of anything easier than /{

[{ will go to an unmatched one, but that isn't what you want.

Jeff Walker
+1 - I think [{ is exactly what he wants
Peter van der Heijden
This will get me to the next { which is not what I want. May be ?{ will work. Please see the comments in the code snippet
VNarasimhaM
actually [{ is what exactly i was looking for... Thanks!!!!
VNarasimhaM
A: 

There's always /{

That is, search for the next open brace.

Emil