Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I exclusively indent a code block in vim?

Tags:

vim

There are a surprising number of questions on this subject, yet some how none of them answer what I want.

I have a code block as follows:

void foo {

somecodehere
morecode
...

}

As you can see the guts of my function are indents on the same level as the rest of my code block. What I currently do is >% on the end of my block (ie the }) which indents the entire block, including the lines with my curly braces.

What I'd like to do is a similar command which indented every line in between excluding my curly braces.

I can not begin to tell you how much time this would save me.

like image 449
tzenes Avatar asked Sep 29 '10 14:09

tzenes


1 Answers

Rather than mapping something new, >i{ seems to do what you want here, but it moves the cursor.

like image 63
Randy Morris Avatar answered Sep 26 '22 05:09

Randy Morris