我当时正在打虚拟高尔夫(顺便说一句,我很容易上瘾),我无法理解http://vimgolf.com/challenges/4d1a34ccfa85f32065000004这个挑战的解决方案之一
目前的挑战是如何转换这一案文:
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对此:
通过使第二行与第一行相同,使对线匹配起来:
# 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/#/+2d<CR>:<Up><BS><BS>1t.<CR>ZZ第二行我指的是:g/#/+1t.
发布于 2011-12-13 19:09:13
正如您可能已经知道的那样:g/ # /为包含一个#的所有行运行一个命令,这是不同挑战的主题。
现在,由于你的第一行已经删除了“错误”行,第二行只是抄袭了剩下的一行。
在#-Line中,向前移动一行(+1)并将(t)复制到当前行(.)
剩下两行相同的线。
https://unix.stackexchange.com/questions/26745
复制相似问题