Nona
Nona

Reputation: 5462

What does norm dd"0P in this series of Vim commands?

I'm doing a Vimgolf problem to transform this:

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

to this:

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.

One solution is:

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

What is :g/J/norm dd"0P doing? I understand that "J" joins lines, and ":g" is global, but I don't understand the rest.

Upvotes: 1

Views: 132

Answers (1)

fretuchich
fretuchich

Reputation: 61

By pieces:

So this replaces the current line with the yanked block.

Upvotes: 6

Related Questions