2016-09-23 100 views
1

我做了Vimgolf問題,改造這個?什麼標準DD「0P在這一系列的Vim命令

First: 
     Junk text. 
Second: 
     Junk text. 
Third: 
     Junk text. 
Last: 
     Copy these lines, 
     and replace the text 
     in each heading above. 

這樣:

First: 
     Copy these lines, 
     and replace the text 
     in each heading above. 
Second: 
     Copy these lines, 
     and replace the text 
     in each heading above. 
Third: 
     Copy these lines, 
     and replace the text 
     in each heading above. 
Last: 
     Copy these lines, 
     and replace the text 
     in each heading above. 

一種解決方案是:

:8,$y<CR>:g/J/norm dd"0P<CR>ZZ 

:g/J/norm dd"0P在做什麼?我知道「J」加入了行,而「:g」是全局的,但我不明白其餘的。

+2

這裏'J'不加入行!它匹配包含* J *的行。全球指揮的第二部分是匹配線路的模式。 – dNitro

回答