![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
indentar en vimFuente: http://stackoverflow.com/questions/235839/indent-multiple-lines-quickly-in-viBásicamente es ponerte al inicio del bloque y hacer
General Commands
>> Indent line by shiftwidth spaces
<< De-indent line by shiftwidth spaces
5>> Indent 5 lines
5== Re-indent 5 lines
>% Increase indent of a braced or bracketed block (place cursor on brace first)
=% Reindent a braced or bracketed block (cursor on brace)
<% Decrease indent of a braced or bracketed block (cursor on brace)
]p Paste text, aligning indentation with surroundings
=i{ Re-indent the 'inner block', i.e. the contents of the block
=a{ Re-indent 'a block', i.e. block and containing braces
=2a{ Re-indent '2 blocks', i.e. this block and containing block
>i{ Increase inner block indent
<i{ Decrease inner block indent
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 . Repeat last command , so indentation commands can be easily and conveniently repeated. Re-indenting complete filesAnother common situation is requiring indentation to be fixed throughout a source file (how-it-works): gg=G Re-indent entire buffer Variables that govern indentationYou can set these in your .vimrc file. set expandtab "Use softtabstop spaces instead of tab characters for indentation set shiftwidth=4 "Indent by 4 spaces when using >>, <<, == etc. set softtabstop=4 "Indent by 4 spaces when pressing <TAB> set autoindent "Keep indentation from previous line set smartindent "Automatically inserts indentation in some cases set cindent "Like smartindent, but stricter and more customisable |