When I delete something in vim, it's added to the numbered registers. The last item I yanked is in register 0. How can I get vim to automatically remember the last 10 yanks too?
I've tried YankRing, but it changes too much of vim behavior. An alternative phrasing of this question: How can I configure YankRing so it only adds the Ctrl-n/Ctrl-p behavior after pasting (to cycle through previous yanks)?
I often yank a word, visual select another word, paste, visual select another word, paste. Without YankRing, the last paste puts the first selected word. With YankRing, it pastes the same word again. (This is just one example.)
Here are some of my yankring settings. As you can see, I've looked through the YankRing docs to disable as many options as I can to revert to normal vim behavior.
" Some settings to try to get yank ring to not mess with default vim
" functionality so much.
let g:yankring_manage_numbered_reg = 0
let g:yankring_clipboard_monitor = 0
let g:yankring_paste_check_default_buffer = 0
" Don't let yankring use f, t, /. It doesn't record them properly in macros
" and that's my most common use. Yankring also blocks macros of macros (it
" prompts for the macro register), but removing @ doesn't fix that :(
let g:yankring_zap_keys = ''
" Disable yankring for regular p/P. This preserves vim's normal behavior, but
" I can still use C-p/C-n to cycle through yankring.
let g:yankring_paste_n_bkey = ''
let g:yankring_paste_n_akey = ''
let g:yankring_paste_v_key = ''
You could try plugin yankstack: a lightweight implementation of the Emacs ‘kill ring’ for Vim.
Its description states that ‘This plugin is intended to be a simpler alternative to the yankring plugin’.
You can use the " command to specify a register for yanking. From :help quote
:
*quote*
"{a-zA-Z0-9.%#:-"} Use register {a-zA-Z0-9.%#:-"} for next delete, yank
or put (use uppercase character to append with
delete and yank) ({.%#:} only work with put).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With