在vi中快速缩进多行 [英] Indent multiple lines quickly in vi
问题描述
它应该是微不足道的,甚至可能在帮助中,但我不知道如何导航。如何在vi中快速缩进多行?
It should be trivial, and it might even be in the help, but I can't figure out how to navigate it. How do I indent multiple lines quickly in vi?
推荐答案
使用> 命令。要缩进五行,请 5 > > 。要标记一行并缩进, V j j > 可以缩进三行(仅Vim) 。要缩进大括号块,请将光标放在大括号之一上并使用> %或在块内的任何地方使用> < kbd> i B 。
Use the > command. To indent five lines, 5>>. To mark a block of lines and indent it, Vjj> to indent three lines (Vim only). To indent a curly-braces block, put your cursor on one of the curly braces and use >% or from anywhere inside block use >iB.
如果要在周围复制文本块,并且需要在其中对齐块的缩进它的新位置,请使用] p ,而不仅仅是 p 。这会将粘贴的块与周围的文本对齐。
If you’re copying blocks of text around and need to align the indent of a block in its new location, use ]p instead of just p. This aligns the pasted block with the surrounding text.
此外, shiftwidth
设置可让您控制要缩进多少空格。
Also, the shiftwidth
setting allows you to control how many spaces to indent.
这篇关于在vi中快速缩进多行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!