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 11: Line 11:
 
|category2=
 
|category2=
 
}}
 
}}
This tip explains how to cycle between several registers, while accessing their content through the standard "unnamed" register (<code>@"</code>).
+
This tip explains how to cycle between several registers, while accessing their content through the standard "unnamed" register (<tt>@"</tt>).
   
 
To easily swap between different registers it is convenient to map a key to move the registers in a "circular list". The following mapping illustrates the idea:
 
To easily swap between different registers it is convenient to map a key to move the registers in a "circular list". The following mapping illustrates the idea:
Line 18: Line 18:
 
</pre>
 
</pre>
   
Now you can cycle between the registers <code>""</code>, <code>"a</code>, <code>"b</code> by pressing <code>\s</code> (assuming the default backslash for the leader key).
+
Now you can cycle between the registers <tt>""</tt>, <tt>"a</tt>, <tt>"b</tt> by pressing <tt>\s</tt> (assuming the default backslash for the leader key).
*<code>:let @a=@b</code> copies register <code>"b</code> to register <code>"a</code>.
+
*<tt>:let @a=@b</tt> copies register <tt>"b</tt> to register <tt>"a</tt>.
*<code>|</code> separates Ex commands; <code>\</code> escapes the pipe for the map command.
+
*<tt>|</tt> separates Ex commands; <tt>\</tt> escapes the pipe for the map command.
   
 
This is also useful if you want to copy between the xclipboard and the unnamed standard register of Vim:
 
This is also useful if you want to copy between the xclipboard and the unnamed standard register of Vim:
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)