vim - Indenter plusieurs lignes rapidement dans vi

Mots clés : vimeditorindentationvivimvi

meilleur 2 Réponses vim - Indenter plusieurs lignes rapidement dans vi

vote vote

98

>>   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 
.    Repeat last command 
gg=G  Re-indent entire buffer 
" Re-indent all your C source code: :args *.c :argdo normal gg=G :wall 
" Re-indent all open buffers: :bufdo normal gg=G:wall 
Vjj> Visually mark and then indent three lines 
CTRL-t   insert indent at start of line CTRL-d   remove indent at start of line 0 CTRL-d remove all indentation from line 
:< and :> Given a range, apply indentation e.g. :4,8>   indent lines 4 to 8, inclusive 
ma     Mark top of block to indent as marker 'a' 
>'a    Indent from marker 'a' to current location 
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 
if has ("autocmd")     " File type detection. Indent based on filetype. Recommended.     filetype plugin indent on endif 
vote vote

87

gg=G 

Questions similaires