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...
The % key. You can use the % key to jump to a matching opening or closing parenthesis, square bracket or a curly brace.
You simply put your cursor on a brace or parenthesis, press %, and Vi will move the cursor to the corresponding brace or parenthesis.
Can't think of anything easier than /{
[{
will go to an unmatched one, but that isn't what you want.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With