Wikia

Vim Tips Wiki

Changes: Copy, cut and paste

Edit

Back to page

Line 1: Line 1:
{{review}}
 
{{TipImported
 
|id=312
 
|previous=311
 
|next=313
 
|created=August 13, 2002
 
|complexity=intermediate
 
|author=Anis W. Nugroho
 
|version=5.7
 
|rating=688/270
 
|category1=Getting started
 
|category2=
 
}}
 
Ever try to cut (or copy) some lines and paste to another place? If you need to count the lines first, then try these to eliminate counting task.
 
   
Cut and paste:
+
<div class="panel-group visible-xs hidden-md hidden-sm hidden-lg" id="accordion"
#Position the cursor where you want to begin cutting.
+
data-bind="foreach: pasajesDisponibles">
#Press v (or upper case V if you want to cut whole lines).
+
<div class="panel panel-Pasajes">
#Move the cursor to the end of what you want to cut.
+
<div class="panel-heading">
#Press d.
+
<h4 class="panel-title">
#Move to where you would like to paste.
+
<a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#accordion"
#Press P to paste before the cursor, or p to paste after.
+
data-bind="attr: { href:'#collapse' + $index() }">
+
<ul class="list-inline">
'''Copy and paste''' can be performed with the same steps, only pressing y instead of d in step 4.
+
<li style="width: 200px"><strong><span class="empresa" data-bind="text: NombreProveedorTransportista">
+
</span></strong></li>
The name of the mark used is related to the operation (d:delete or y:yank).
+
<li>
+
<p>
I found that those mark names requires minimal movement of my finger.
+
<b><span data-bind="text: '$ ' + Precio + ',00'"></span></b>
+
</p>
==Comments==
+
</li>
If you want to copy and paste between editor buffers (but not between instances of vim), or if you want to maintain multiple "clipboards" (copy buffers), you can name your buffer by pressing "x (that's a double quote followed by x, where x is the single letter name you choose for your buffer) before the d in step 4, and again before the p in step 6.
+
<li class="pull-right">
+
<button class="btn btn-default btn-xs" data-bind="click: $parent.pasajeSeleccionado">
If you happen to be using gvim for Windows and want to copy or cut into the Windows clipboard, press Ctrl+Insert in step 4 (to copy) or Shift+Delete to cut. To paste from the Windows clipboard, press Shift+Insert.
+
<i class=" glyphicon glyphicon-shopping-cart icon-white"></i>
+
</button>
----
+
</li>
How copy and paste between two instances of Vim on different Linux consoles?
+
</ul>
+
</a>
After copying text, open a new buffer for a new file:
+
</h4>
:e ~/dummy
+
</div>
+
<div data-bind="attr: { id:'collapse' + $index() }" class="panel-collapse collapse"
paste the text to the new buffer<br>
+
style="height: 0px;">
write the new buffer (:w)<br>
+
<div class="panel-body row">
switch to the previous buffer (:bp) to release *.swp<br>
+
<div class="col-xs-6 col-sm-6 col-md-6 ">
now switch to the other console<br>
+
<dl>
put the cursor at the desired place<br>
+
<dt>Fecha Salia : </dt>
read the dummy file (:r ~/dummy)
+
<dd>20/10/2013</dd>
+
<dt>Comodidad : </dt>
----
+
<dd><span data-bind="text: Calidad"></span></dd>
If you want to simulate the Windows way of Cut/Copy/Paste you could add the following line to your initialization file.
+
<dt>Fecha Llegada : </dt>
+
<dd>21/10/2013</dd>
source $VIMRUNTIME/mswin.vim
+
</dl>
+
</div>
Read :help :behave for other information.
+
<div class="col-xs-6 col-sm-6 col-md-6 ">
+
<dl>
----
+
<dt>
See [[VimTip356|Quick yank and paste]].
+
<button type="button" class="btn btn-Comprar btn-sm">
+
<span class="glyphicon glyphicon-shopping-cart white"></span>
----
+
<span class="white">Comprar</span>
Why can I not copy and paste a block of 200 lines? The yank works fine, but the paste only does about 50.
+
</button>
+
</dt>
----
+
</dl>
same problem with me (50 line limit). I've fixed this before but dont dont remember what the fix was.
+
</div>
+
</div>
----
+
</div>
Increase the buffer limit between multiple files.
+
</div>
+
</div>
:help 'viminfo'
 
...
 
< Maximum number of lines saved for each register.
 
...
 
:set viminfo?
 
:set viminfo='100,<100,s10,h
 

Revision as of 14:02, October 11, 2013

Around Wikia's network

Random Wiki