"re-indent" means "indent lines according to your indentation settings." shiftwidthGeneral Commands You can replace { with } or B, e.g. =iB is a valid block indent command. Take a look at "Indent a Code Block" for a nice example to try these commands out on.Also, remember that , so indentation commands can be easily and conveniently repeated.Re-indenting complete files Another common situation is requiring indentation to be fixed throughout a source file: You can extend this idea to multiple files:Or multiple buffers:In Visual ModeIn insert modeThese commands apply to the current line: Ex commandsThese are useful when you want to indent a specific range of lines, without moving your cursor. Indenting using markersAnother approach is via markers: ...move cursor to end locationVariables that govern indentationYou can set these in your .vimrc file. Vim has intelligent indentation based on filetype. Try adding this to your .vimrc: |
Labels
- Linux (22)
- QT (7)
- HTML (6)
- Algorithms (4)
- Python (3)
- SVN (3)
- interview questions (3)
- MySql (2)
- OO design (2)
- Perl (2)
- XML (2)
- brain Teaser (2)
- C++ (1)
- CSS (1)
- Debug (1)
- IPhone开发 (1)
- Math (1)
- Recursion (1)
- ShellScript (1)
- VM (1)
- Windows (1)
- programming (1)
- 业界动态 (1)
Friday, March 23, 2012
indent multiple lines quickly in vim
http://stackoverflow.com/questions/235839/how-do-i-indent-multiple-lines-quickly-in-vi
Labels:
Linux
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment