Vim Tips Wiki
No edit summary
m (Reverted edits by Emprego.curitiba (talk | block) to last version by JohnBeckett)
Line 50: Line 50:
 
*Clean up and check advice.
 
*Clean up and check advice.
 
*This duplicates some of [[VimTip224|224 Shifting blocks visually]] and [[VimTip1130|1130 Format a code block]]. Consider merge.
 
*This duplicates some of [[VimTip224|224 Shifting blocks visually]] and [[VimTip1130|1130 Format a code block]]. Consider merge.
<div style="margin-left:-9999px;">[http://www.vipsexshop.com.br Sex Shop][http://www.requintesexshop.com.br Sex Shop][http://www.sexshop.com.vc Sex Shop][http://www.belasexshop.com.br Sex Shop][http://www.belasexshop.com Sex Shop][http://blog.vipsexshop.com.br Dicas de Sexo][http://www.viplingerie.com.br Lingerie][http://www.vipcalcinhas.com.br Calcinhas][http://www.uniformesbr.com Uniformes Profissionais][http://www.uniformesbr.com Uniformes]</div>
 

Revision as of 15:32, 8 November 2011

Tip 597 Printable Monobook Previous Next

created 2003 · complexity intermediate · author Marcel Preda · version 6.0


This tip contains information about adjusting the indent of source code in a block formed by braces ({...}), such as is used in the C language.

For related information, see:

Commands to indent blocks

Suppose the indent options are correctly defined and we find this badly indented code:

int myfunction(int a)
 {
 if ( a == 1 ) {
 printf("one");
return 1;        // the cursor is in this line
 }
 return 0;
   }

These commands will fix the indents:

  • =i{ reindents "inner block" (inside the braces).
  • =a{ reindents "a block" (including the braces).
  • =2a{ reindents 2 blocks (this block and containing block).

Instead of "{", you can use "}" or "B", for example, =aB indents a block.

These commands will decrease or increase indents:

  • >i{ increase indent for inner block.
  • . repeat last change (increase indent of block again).
  • <i{ decrease indent for inner block.

With the cursor on { or }:

  • =% indents the block (including matching brace).
  • >% or <% indents or unindents the block.

Comments

 TO DO