summaryrefslogtreecommitdiff
path: root/src/Indenting_in_VI.adoc
blob: d0e99327e36f392813906db496007bb70cc0e83a (plain)
    1 Indenting in Vi
    2 ===============
    3 :author: Aaron Ball
    4 :email: nullspoon@iohq.net
    5 
    6 == {doctitle}
    7 
    8 Just a quick post here. Today I was writing a perl script and I had a 29 line
    9 block of code I wanted to indent. After a bit of research (thanks
   10 stackoverflow), I found what I was looking for.
   11 
   12 If you want to indent a block surrounded by braces/brackets, select the top
   13 brace/bracket with the cursor...
   14 
   15 Type +<%+ to indent the entire block
   16 
   17 Type +<%+ to unindent the entire block
   18 
   19 This is without going into insert mode (hint: if vi is actually typing your
   20 commands, hit escape).
   21 
   22 To indent based on a number of lines, use the following
   23 
   24 Type +5>>+ to indent five lines starting where your cursor is
   25 
   26 Type +9>>+ to unindent nine lines starting where your cursor is
   27 
   28 I hope that helps someone. It made my day a few notches better, that's for
   29 sure.
   30 
   31 That's all for now. Signing out.
   32 
   33 
   34 Category:Linux
   35 Category:Editors
   36 
   37 
   38 // vim: set syntax=asciidoc:

Generated by cgit