加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

vim – 将一组线附加到另一组线的末尾

发布时间:2020-12-15 21:15:06 所属栏目:安全 来源:网络整理
导读:比方说,我连续10行后跟另外10行,例如, 12:10ab:j 我想将第二组线附加到第一组线的末尾,以便它看起来像这样: 1a2b:10j 解决方法 这将是我的方式: qaG"aDdd9-$"apq9@a 说明: q # Begin recording typed characters...a # to register 'a'G # Set cursor in
比方说,我连续10行后跟另外10行,例如,

1
2
:
10
a
b
:
j

我想将第二组线附加到第一组线的末尾,以便它看起来像这样:

1a
2b
:
10j

解决方法

这将是我的方式:

qaG"aDdd9-$"apq
9@a

说明:

q             # Begin recording typed characters...
a             # to register 'a'
G             # Set cursor in last line.
"aD           # Delete the content from the beginning of line till the end and save it in register 'a'.
dd            # Previous command deleted the content but left the line in blank,delete the complete line.
9-            # Go back 9 lines.
$            # Set cursor at the end of current line (last number in your example).
"ap           # Paste content of register 'a' (at end of line without newline character).
q             # Stop recording.
---------------
9             # Run nine times.
@a            # Commands of register 'a' (all previous commmands).

>注册’a’我记录命令的位置是我保存每行内容的不同寄存器,尽管它们的名称相同(字母’a’).

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读