2013-12-21 65 views
0

the VimGolf challenge如何解讀此VimGolf答案?

來源:

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中的相關部分?

謝謝。

回答

5
:g/v/command 

在與v匹配的每一行上執行command

:t. 

將當前行復制到其自身下方。

之後,原來的「第二行」被刪除。

簡而言之,該解決方案的作者思考開箱即用:不是操縱第二行,他只是複製第一行並刪除第二行。

對於文檔:

:help :g 
:help :t 
相關問題