在 vi 中快速缩进多行 [英] Indent multiple lines quickly in vi

查看:27
本文介绍了在 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>>.要标记一行并缩进,Vjj> 以缩进三行​​(仅 Vim).要缩进花括号块,请将光标放在其中一个花括号上并使用 >% 或从块内的任何位置使用 >iB.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆