Vim Tips Wiki
Register
We recommend that you log in before editing. This will allow other users to leave you a message about your edit, and will let you track edits via your Watchlist. Creating an account is quick and free.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 13: Line 13:
 
If you ever need to cut/copy/delete/paste lines without knowing the actual number of lines, here is what you should do.
 
If you ever need to cut/copy/delete/paste lines without knowing the actual number of lines, here is what you should do.
 
#In normal mode, go to the beginning of the section that you want to yank.
 
#In normal mode, go to the beginning of the section that you want to yank.
#Type <code>mk</code> to mark this spot as <code>k</code>.
+
#Type <tt>mk</tt> to mark this spot as <tt>k</tt>.
 
#Go to the end of the section you want to yank using whatever movement commands you like.
 
#Go to the end of the section you want to yank using whatever movement commands you like.
#Type: <code>y'k</code> (<y-yank>, <single quote-go to mark>, k) To yank from the mark to the current location.
+
#Type: <tt>y'k</tt> (<y-yank>, <single quote-go to mark>, k) To yank from the mark to the current location.
#You can paste those lines wherever you want with <code>p</code>
+
#You can paste those lines wherever you want with <tt>p</tt>
   
Similarly, <code>d'k</code> will cut/delete the lines from the current location to the mark.
+
Similarly, <tt>d'k</tt> will cut/delete the lines from the current location to the mark.
   
 
==Comments==
 
==Comments==
Line 63: Line 63:
   
 
----
 
----
Go to the start of the block and mark it as <code>mx</code> then go to the end of block and mark it as <code>my</code>.
+
Go to the start of the block and mark it as <tt>mx</tt> then go to the end of block and mark it as <tt>my</tt>.
   
Do <code>`x</code> (move to start of block), then do <code>y`y</code> (copy the block) or <code>d`y</code> (delete the block).
+
Do <tt>`x</tt> (move to start of block), then do <tt>y`y</tt> (copy the block) or <tt>d`y</tt> (delete the block).
   
 
----
 
----
Please note that all contributions to the Vim Tips Wiki are considered to be released under the CC-BY-SA
Cancel Editing help (opens in new window)