How to paste over without overwriting register

后端 未结 10 2569
粉色の甜心
粉色の甜心 2020-11-28 02:41

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 alway

10条回答
  •  清歌不尽
    2020-11-28 03:34

    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:

    function! YRRunAfterMaps()                                                                                                      
        " From Steve Losh, Preserve the yank post selection/put.    
        vnoremap p :YRPaste 'p', 'v'gv:YRYankRange 'v' 
    endfunction  
    

提交回复
热议问题