ANN: YankRing 3.0

45 views
Skip to first unread message

David Fishburn

unread,
Sep 7, 2007, 11:34:07 PM9/7/07
to vim...@googlegroups.com


YankRing.vim : Maintains a history of previous yanks and deletes
http://www.vim.org/scripts/script.php?script_id=1234

description
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 and deleted text.  After text has been pasted, it can be replaced with a previous value from the yankring.


New features and bug fixes for this version:

NF: Converted the yankring to use the new Vim7's List object which means it is no longer compatible with Vim6.

NF: By default the yankring will now maintain the yankring's items persistently by default.  It does this via the |viminfo| file. This means the contents of the yankring rely on the internal variables of only 1 Vim instance.

BF: YRToggle was not unmapping 'gp' and 'gP'.

BF: YRSearch prompted the user for a regex even if one was provided on the command line.

BF: If g:yankring_manage_numbered_reg is enabled, the "." operator did not correctly repeat the previous action (Pedro DeRose).


Enjoy.
Dave


Michael

unread,
Sep 9, 2007, 9:09:17 PM9/9/07
to vim...@googlegroups.com
I upgraded to version 3.0, but a window is popped up which says :YR: The
yankring can only persist if viminfo setting has a "!".
Why?
Michael
10 Sep, 2007

Tony Mechelynck

unread,
Sep 9, 2007, 9:30:40 PM9/9/07
to vim...@googlegroups.com

I suppose that that plugin saves its data from one session to the next by
means of uppercase global variables, which is what the ! flag in 'viminfo' is for.

So if you want to use that plugin, just add

if has('viminfo')
set vi^=!
endif

to your vimrc (^= adds at the beginning; vi+=! -- which adds at the end --
only works if you don't have an n-flag, because n must be last).


Best regards,
Tony.
--
Every absurdity has a champion who will defend it.

David Fishburn

unread,
Sep 9, 2007, 10:46:33 PM9/9/07
to vim...@googlegroups.com
> I upgraded to version 3.0, but a window is popped up which says :YR: The
> yankring can only persist if viminfo setting has a "!".
> Why?

As Tony mentioned, yes, you need to add an "!" to your viminfo line.

New to 3.0 you can persistently store the contents of the yankring in
global variables within the viminfo file. This is the default
behaviour. So if you restart Vim, all your previous yanks and deletes
will still be available to you.

If you do not want to persistently store these values then you can set
the following in your vimrc (as specified in :h yankring.txt):
let g:yankring_persist = 0

Dave

Michael

unread,
Sep 9, 2007, 11:33:39 PM9/9/07
to vim...@googlegroups.com
Thank you, Tony and David.
Best Regards!
Michael
Reply all
Reply to author
Forward
0 new messages