Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
362 views
in Technique[技术] by (71.8m points)

vim - 在vi中快速缩进多行(Indent multiple lines quickly in 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?

(如何在vi中快速缩进多行?)

  ask by Allain Lalonde translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Use the > command.

(使用>命令。)

To indent five lines, 5 > > .

(缩进五线,5>>。)

To mark a block of lines and indent it, V j j > to indent three lines (Vim only).

(要标记一行并缩进,可使用V j j >缩进三行(仅Vim)。)

To indent a curly-braces block, put your cursor on one of the curly braces and use > % or from anywhere inside block use > i B .

(要缩进大括号块,请将光标放在大括号之一上,并使用> 或在block use > i B中的任何位置。)

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 .

(如果要在周围复制文本块并且需要在新位置对齐块的缩进,请使用] p而不是p 。)

This aligns the pasted block with the surrounding text.

(这会将粘贴的块与周围的文本对齐。)

Also, the shiftwidth setting allows you to control how many spaces to indent.

(另外, shiftwidth设置使您可以控制缩进多少空格。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...