在这一系列Vim命令中,norm dd“0P是什么?

在这一系列Vim命令中,norm dd“0P是什么?,vim,Vim,我正在做一个Vimgolf问题来改变这一点: 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 replac

我正在做一个Vimgolf问题来改变这一点:

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 dd0P在做什么?我知道J连接行,并且:g是全局的,但我不了解其余部分。

按片段:

0P-将原来从寄存器0中拉出的行粘贴到中 dd-删除当前行 因此,这会将当前行替换为被拉伸的块。

逐块:

0P-将原来从寄存器0中拉出的行粘贴到中 dd-删除当前行
因此,这将用拉伸块替换当前行。

此处“J”不是连接行!它匹配包含J的行。全局命令的第二部分是匹配行的模式。此处“J”不是连接行!它匹配包含J的行。全局命令的第二部分是匹配行的模式。