Indenting in vim
This question already has an answer here:
First, for indenting there's both the >
command, which simply shifts to the right by adding one level of indent (how much is determined by the 'shiftwidth'
option, and 'expandtab'
tells whether to use Tabs or spaces), and the =
command, which applies (language-specific) indentation rules.
Both commands work on line(s) when doubling, ie >>
/ ==
; you address multiple lines by prepending a number.
But they also take a {motion}
, eg 3j
(3 lines down), or }
(to the end of the paragraph).
And finally, you can make a visual selection ( V
), make it the right size, and then apply the command to it.
hilite代码和类型>
上一篇: 在VIM中缩进一堆线
下一篇: 在vim中缩进