当前位置: 动力学知识库 > 问答 > 编程问答 >

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.

网友答案:

By pieces:

  • "0P - Paste the originally yanked line from register 0. As read in http://unix.stackexchange.com/a/26716
  • dd - delete current line

So this replaces the current line with the yanked block.

分享给朋友:
您可能感兴趣的文章:
随机阅读: