[Vim] Indent+Formatting

Thursday, May 7, 2009
Indent
  1. VISUAL mode, there're 2 kinds of visual mode, stated as follow:
    1. -- VISUAL BLOCK MODE -- (Selection by block): Ctrl + v
    2. -- VISUAL LINE MODE -- (Selection by line): Shift + v
  2. Move your cursor, select(highlight) the blocks/lines you want to indent
  3. Commands for indent:
    1. Increase indent: Shift + .
    2. Decrease indent: Shift + ,
Formatting
  1. Enter COMMAND mode (press ESC in insert mode)
    1. Format the whole document:gg=G
    2. Format from line m to n:mG=nG

0 意見: