the VimGolf challenge
发自:
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最需要击键次数最少的答案之一是:
:g/v/t.|+d<CR>ZZ
我在试着理解为什么这是可行的。在这种情况下,v、.、|的含义是什么?此外,在:help中哪里可以找到相关的部分
谢谢。
发布于 2013-12-21 14:46:44
:g/v/command对与v匹配的每一行执行command。
:t.复制其自身下面的当前行。
之后,删除原来的“第二行”。
简而言之,该解决方案的作者正在跳出框框:他不是操作第二行,而是简单地复制第一行并删除第二行。
至于文档:
:help :g
:help :thttps://stackoverflow.com/questions/20716217
复制相似问题