vim - 可否在粘帖时保持垂直方向对齐?

浏览:56日期:2023-08-13

问题描述

系统粘帖板里有如下内容。

homehelpvariablesvi compatibilitymodelinesword&line completionsearchingtext selectionmarketsindentingreformatting

我想复制到文件成下面的格式。

home help variables vi compatibility modelines word&line completion searching text selection markets indenting reformatting

请问,有无偷懒的办法?

第一次光标在行首,使用 '+p 粘帖的结果

homehelpvariablesvi compatibilitymodelinesword&line completionsearchingtext selectionmarketsindentingreformatting

第二次光标在第五列,使用 '+p 粘帖的结果

homehelpvariablesvi compatibilitymodelinesword&line completionsearchingtext selectionmarketsindentingreformatting

可否一次粘帖成这样?第一次粘帖的结果,运行 %s/^/ /g第二次粘帖的结果,运行 1,$s/^/ /g都可以得到下面的结果,我想偷懒一次就做到这样的结果,请问,可以做到吗?

home help variables vi compatibility modelines word&line completion searching text selection markets indenting reformatting

问题解答

回答1:

:set ai

then i tab Ctrl-v

回答2:

'+pVG>

回答3:

设置成自动缩进试试

:set autoindent回答4:

:set paste

回答5:

首先shift+v选中一行然后按j向下选中多行,最后shift + >, 不知道是不是你要的。

相关文章: