YankRing is a Vim plugin that maintains a history of previous yanks and deletes. Vim already maintains a list of numbered registers containing the last 9 deletes. These previous deletes can be referenced using [register]p, so "1p will paste the last delete, "2p the 2nd last delete. For more information see |quote_number|.
Vim does not provide any mechanism to reference previous yanked text. In Emacs this feature is called the "kill ring".
The yankring plugin allows the user to configure the number of yanked, deleted and changed text. A split window can be used to choose which element(s) from the yankring you wish to paste. Alternately after text has been pasted (using p), it can be replaced with a previous value from the yankring with a single key stroke.
A tutorial is included to take you through the various features of the
plugin. After you have installed the plugin just run:
The yankring can be interacted with in two ways: a GUI or via maps.
The yankring supports all of Vim motions and text-objects. There are no new keystrokes the user must learn. One keystroke to open the yankring
to choose which item to paste is all that is required. It has been designed to seamlessly work with Vim.
All the mappings and behaviours are configurable via global variables you
can optionally specify in your vimrc.
The plugin can be toggled on and off, and supports:
All visual modes (characterwise, linewise and blockwise)
yy - Adds the current line to the yankring.
dd - Adds the current line to the yankring and deletes it.
5yw - Adds 5 words to the yankring.
"ade - Deletes the word, and puts it into both the yankring and the "a register.
cw - Changes the word and stores the previous value in the yankring.
10"zyy - Places 10 lines into both the yankring and the "z register.
:1,4YRYankRange - Similar to 1,4y
:3,$YRDeleteRange - Similar to 3,$d
If you wish to paste previous values from the yankring there are only two
additional maps you must learn (these are configurable via your vimrc if
needed). The purpose of the yankring is to gain access to previously yanked (or deleted) elements. The YRReplace command will replace the previously pasted text with a different entry from the yankring.
By default, I choose < C-P > (P for previous) to replace the text last pasted while moving backwards through your previous text from the yankring and (N for next) to replace the previous paste while moving forward through the yankring.
What's New in This Release:
· NF: The yankring by default now captures all |text-objects| and all motions (|motion.txt|) which Vim supports. Version 3.0 only supported a subset of the basic motion commands.
· NF: Prior to this version only predefined maps triggered the capture of data into the yankring. These maps only supported yanks and deletes. The yankring now also supports operator-pending mode, which allows a greater range of operations to be automatically captured and added to the yankring. Operating pending mode functionality requires Vim 7.2 or Vim 7.1 with patch #205. If using Vim 7.1 you can determine this with: echo has("patch205")
· NF: Prior to this version only yanks and deletes were registered in the yankring. Changes are now also captured into the yankring.
· NF: The yankring will also capture the system cliboard when focus is returned to the vim window. This is useful if you copy text between applications.
· NF: The yankring window always opened bottom horizontal. Now it can be opened top or bottom and horizontal or vertically. This can be controlled via variables in your .vimrc.
· BF: The yankring has an option to persist between instances of Vim by storing the values in global variables within the viminfo. This has led to some unusual ordering of items in the ring from conflicts between instances. This option has been turn off by default.
· BF: Their was an issue with yanking using y$.