题目链接

Simple text editing with Vim

题目说明

简单的文字编辑。

开始文件

Make the pairs of lines match up by making each second line same as first:

# Appending text:
The name "Vim" is an acronym for "Vi IMproved"
The name "Vim" is an acronym for

# Editing text:
Vim is a text editor originally released by Bram Moolenaar in 1991 for the Amiga
Trivia: Vim is a text editor released by Bram Moolenaar in 1991 for the Amiga

# Deleting text:
Vim has a vi compatibility mode
Vim has a vi compatibility mode but when not in this mode Vim has many enhancements over vi

结束文件

Make the pairs of lines match up by making each second line same as first:

# Appending text:
The name "Vim" is an acronym for "Vi IMproved"
The name "Vim" is an acronym for "Vi IMproved"

# Editing text:
Vim is a text editor originally released by Bram Moolenaar in 1991 for the Amiga
Vim is a text editor originally released by Bram Moolenaar in 1991 for the Amiga

# Deleting text:
Vim has a vi compatibility mode
Vim has a vi compatibility mode

最佳分数

13

我的分数

14

qq3jYjVpq2@qZZ

第一次尝试

其实只需要把上边的三行复制到下一行就行了。

jqqjjYpjddq2@qZZ

16 分,差 3 分。

第二次尝试

优化一下,V 后直接粘贴。

qq3jYjVpq2@qZZ

14 分,还差 1 分。

第三次尝试

想不到怎么优化了。

@antonyscriven

:g/V/t.|+d<CR>ZZ

用的是完全不同的方法。:g/V/t. 是把包含 V 的行复制一遍,+d 是删掉光标的下一行。运行时它会把第 4 行复制一遍,现在光标在第 5 行了,+d 就把第 6 行删了,于是第一部分就改好了。后两部分也同理。

最佳操作

@antonyscriven

:g/V/t.|+d<CR>ZZ

实用操作

@antonyscriven

:g/V/t.|+d<CR>ZZ

13 分。

|td 的灵活使用。

文章目录