Wednesday, November 19, 2008

VIM formatting

To auto format a section of code in vim use '=' followed by a movement command.

For example if you want to format


void foo() {
int blah;
int foo;
int bar;
}

Navigate the the first '{' and press '=%' = will tell it format, where '%' will tell it to go to the corresponding block.