Vim Tips Wiki
(Uploaded by JohnBot from a locally edited file)
(Change <tt> to <code>, perhaps also minor tweak.)
 
(5 intermediate revisions by 2 users not shown)
Line 2: Line 2:
 
{{TipImported
 
{{TipImported
 
|id=71
 
|id=71
|previous=70
+
|previous=68
 
|next=72
 
|next=72
|created=June 4, 2001
+
|created=2001
 
|complexity=basic
 
|complexity=basic
 
|author=Alexey Marinichev
 
|author=Alexey Marinichev
 
|version=5.7
 
|version=5.7
 
|rating=128/44
 
|rating=128/44
  +
|category1=
  +
|category2=
 
}}
 
}}
If you use gvim, you can transfer text from one instance of gvim into another using the <tt>+</tt> register.
+
If you use gvim, you can transfer text from one instance of gvim into another using the <code>+</code> register.
   
 
For example, in one instance, yank two lines:
 
For example, in one instance, yank two lines:
  +
<pre>
 
"+2yy
+
"+2yy
  +
</pre>
   
 
Paste it in another instance in normal mode:
 
Paste it in another instance in normal mode:
  +
<pre>
 
"+p
+
"+p
  +
</pre>
   
 
or in insert mode:
 
or in insert mode:
  +
<pre>
 
&lt;Ctrl-R&gt;+
+
<Ctrl-R>+
  +
</pre>
   
 
==References==
 
==References==
Line 35: Line 40:
 
See also [[VimTip66]] which works for gvim as well as vim.
 
See also [[VimTip66]] which works for gvim as well as vim.
   
  +
----
  +
Excellent tip, solved a headache of mine. As the first comment noted, one can, obviously, just copy to the clipboard as with any app. But suppose you don't want to lose the contents of the clipboard? Or you don't want inadvertently to paste material from a Vim session into some other app with a careless CTRL-V? Much better to segregate yanked stuff into registers. This makes working with multiple instances of gvim quite practical for me now.
  +
<pre>
  +
:silent !ls -a| gvim -R -
  +
</pre>
  +
  +
Then heavy use of gf and I'm happily moving text around between gvim instances on separate monitors.
 
----
 
----

Latest revision as of 05:11, 13 July 2012

Tip 71 Printable Monobook Previous Next

created 2001 · complexity basic · author Alexey Marinichev · version 5.7


If you use gvim, you can transfer text from one instance of gvim into another using the + register.

For example, in one instance, yank two lines:

"+2yy

Paste it in another instance in normal mode:

"+p

or in insert mode:

<Ctrl-R>+

References[]

Comments[]

In gvim, for the "copy to clipboard" command, Ctrl+C works just as well on highlighted text as "+y. This works for both text in the edit buffer and characters on the command line.


See also VimTip66 which works for gvim as well as vim.


Excellent tip, solved a headache of mine. As the first comment noted, one can, obviously, just copy to the clipboard as with any app. But suppose you don't want to lose the contents of the clipboard? Or you don't want inadvertently to paste material from a Vim session into some other app with a careless CTRL-V? Much better to segregate yanked stuff into registers. This makes working with multiple instances of gvim quite practical for me now.

:silent !ls -a| gvim -R -

Then heavy use of gf and I'm happily moving text around between gvim instances on separate monitors.