Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
550 views
in Technique[技术] by (71.8m points)

vim - 将所有行复制到剪贴板(Copy all the lines to clipboard)

Is there any way to copy all lines from open file to clipboard in VI editor.

(有没有办法在VI编辑器中将所有行从打开文件复制到剪贴板。)

I tried y G but it's not using clipboard to store those lines.

(我试图?g,但它不使用剪贴板来存储这些行。)

So is it possible?

(那有可能吗?)

  ask by Xinus translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Use:

(使用:)

: % y +

( y +)

to yank all lines.

(猛拉所有线路。)

Explanation:

(说明:)

  • % to refer the next command to work on all the lines

    (%来引用下一个命令来处理所有行)

  • y to yank those lines

    (y那些线)

  • + to copy to the system clipboard

    (+复制到系统剪贴板)

NB : In Windows, + and * are equivalent see this answer .

(注意 :在Windows中, +*相同, 请参阅此答案 。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...