Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
54
rated 0 times [  54] [ 0]  / answers: 1 / hits: 90410  / 3 Years ago, wed, september 8, 2021, 9:36:40

If I use the first vim to copy a line (with yy), how do I paste to another terminal's vim (with p)? Is there any command or settings can do it? Can I copy and paste into the global system clipboard?



I know the following ways are possible, but I want a simpler one:




  1. I do not want to exit the first vim and reopen the second vim.


  2. I do not want to use separate window (with :sp).



More From » vim

 Answers
0

First you must install a clipboard-enabled version of vim. To accommodate users with non-graphical environments (eg Ubuntu Server users), vim and vim-tiny do not hook into this capability. You'll want to install GVim Install GVim, which be launched either graphically or in your terminal. GVim will replace the vim command.



You can yank the text into the 'cut buffer' from the first vim, and then paste the text into the second vim. To copy to the global cut buffer, use the + register. The " key allows you to specify which register to use when doing a yank or paste operation.



In the first vim, yank a line into the + register:



"+yy


then, to paste from the + register in the second vim:



"+p


For more information on the registers available, check out :help registers. You can also use "+p to paste text copied from any other source on your system.


[#43594] Thursday, September 9, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
lawain

Total Points: 150
Total Questions: 106
Total Answers: 101

Location: China
Member since Mon, Aug 22, 2022
2 Years ago
;