>> Indent line by shiftwidth spaces<< De-indent line by shiftwidth spaces5>> Indent 5 lines5== 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
set expandtab "Use softtabstop spaces instead of tab characters for indentationset 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 lineset smartindent "Automatically inserts indentation in some casesset cindent "Like smartindent, but stricter and more customisable
Vim具有基于文件类型的智能缩进。尝试将其添加到您的. vimrc:
if has ("autocmd")" File type detection. Indent based on filetype. Recommended.filetype plugin indent onendif