Does anyone know of a way to paste over a visually selected area without having the selection placed in the default register?
I know I can solve the problem by always pasting from an explicit register. But it's a pain in the neck to type "xp instead of just p
Luc Hermitte's solution works like a charm. I was using it for about a week or so. Then I discovered a solution from Steve Losh's .vimrc that works nicely if YankRing is part of your plugin/bundle lineup:
"{register}p
won't work as you describe. It will replace the selection with the content of the register. You will have instead to do something like:Which should be fine as long as you don't use a plugin that has a non-nore vmap to p, and that expects a register to be overwritten.
This code is available as a script there. Ingo Karkat also defined a plugin solving the same issue.
I don't like the default vim behavior of copying all text deleted with
d
,D
,c
, orC
into the default register.I've gotten around it by mapping
d
to"_d
,c
to"_c
, and so on.From my .vimrc:
try -
In your
.vimrc
I found this from a response on a similar thread, but the original source was http://vim.wikia.com/wiki/Replace_a_word_with_yanked_text. It mentions some drawbacks, however it works fine for me.
Luc's function worked well for me after I made a change to support the fact that I have clipboard=unnamed set: