Vim Tips Wiki
(Remove html character entities)
(Adjust previous/next navigation + minor manual clean)
Line 1: Line 1:
{{review}}
 
 
{{TipImported
 
{{TipImported
 
|id=586
 
|id=586
 
|previous=584
 
|previous=584
|next=587
+
|next=588
|created=October 13, 2003
+
|created=2003
 
|complexity=basic
 
|complexity=basic
 
|author=Usman Latif
 
|author=Usman Latif
Line 12: Line 11:
 
|category2=
 
|category2=
 
}}
 
}}
  +
Using <tt>:put "</tt> pastes text from the default register below the current line. That is useful if some characters within a line have been copied, and you would like the copied text pasted as a separate line.
Frequently I yank a few words or part of a line and like to have them pasted on a separate line. Vim provides the <tt>put</tt> and <tt>put!</tt> commands for that purpose but they are not mapped by default to anything. Typing the commands is much slower than inserting a line and pasting to it so I have created the following maps:
 
   
  +
Use the following mappings in your [[vimrc]] to make that easier. The first pastes after the current line, while the second pastes before the current line.
 
<pre>
 
<pre>
nnoremap ,p :pu "<CR>
+
nnoremap ,p :put "<CR>
nnoremap ,P :pu! "<CR>
+
nnoremap ,P :put! "<CR>
 
</pre>
 
</pre>
   

Revision as of 02:11, 16 May 2012

Tip 586 Printable Monobook Previous Next

created 2003 · complexity basic · author Usman Latif · version 5.7


Using :put " pastes text from the default register below the current line. That is useful if some characters within a line have been copied, and you would like the copied text pasted as a separate line.

Use the following mappings in your vimrc to make that easier. The first pastes after the current line, while the second pastes before the current line.

nnoremap ,p :put "<CR>
nnoremap ,P :put! "<CR>

Comments