I am using VIM
, and I want to format 2nd and 3rd lines. I can do it by :2,3left<number of spaces>
我正在使用VIM,我想格式化第2行和第3行。我可以写成:2,3left< >的空格数
* @brief: Hello world
* Hello world hello world
* Hello world hello world
How to do it easier to get something like this?
如何更容易得到这样的东西?
* @brief: Hello world
* Hello world hello world
* Hello world hello world
2 个解决方案
#1
1
try this pres Esc+: then press v then press enter , select the second and third lines , press = https://www.cs.swarthmore.edu/help/vim/reformatting.html
试试这个pres Esc+:然后按v然后按enter,选择第二行和第三行,按= https://www.cs.swarthmore.edu/help/vim/reformatting.html
#2
1
Not sure if you want to do it programmatically, but by using visual block, you can create a "column" selection one line 2,3 just before the H, and then use > to increase the indentation. If you want to move further, you can then use ..
不确定您是否想以编程方式完成它,但是通过使用visualblock,您可以在H之前创建一个“列”选择1行2,3,然后使用>来增加缩进。如果你想更进一步,你就可以使用。
* @brief: Hello world
*XHello world hello world
* Hello world hello world
Assuming your cursor is on X
假设你的光标在X上
Ctrlvj>.
Ctrlvj >。
If you want to insert 2 spaces, use capital I after visual selection :
如果要插入两个空格,请在视觉选择后使用大写I:
CtrlvjISpaceSpaceEsc
CtrlvjISpaceSpaceEsc
#1
1
try this pres Esc+: then press v then press enter , select the second and third lines , press = https://www.cs.swarthmore.edu/help/vim/reformatting.html
试试这个pres Esc+:然后按v然后按enter,选择第二行和第三行,按= https://www.cs.swarthmore.edu/help/vim/reformatting.html
#2
1
Not sure if you want to do it programmatically, but by using visual block, you can create a "column" selection one line 2,3 just before the H, and then use > to increase the indentation. If you want to move further, you can then use ..
不确定您是否想以编程方式完成它,但是通过使用visualblock,您可以在H之前创建一个“列”选择1行2,3,然后使用>来增加缩进。如果你想更进一步,你就可以使用。
* @brief: Hello world
*XHello world hello world
* Hello world hello world
Assuming your cursor is on X
假设你的光标在X上
Ctrlvj>.
Ctrlvj >。
If you want to insert 2 spaces, use capital I after visual selection :
如果要插入两个空格,请在视觉选择后使用大写I:
CtrlvjISpaceSpaceEsc
CtrlvjISpaceSpaceEsc