Hello,

"Ben Fritz" <[email protected]> wrote :
> > Also, is there any way to disable this behavior? I'm happier
> > knowing that only "d", "c", "s", 'x", and "y" put things into the
> > unnamed buffer.
> 
> :vnoremap p "_d"0P or similar ought to do it.

In order to avoid overwriting the @" register, but still being able to
paste the content of any register, I came up with this [1]

"------------------------------------------------------------------------
" I haven't found how to hide this function (yet)
function! RestoreRegister()
  let @" = s:restore_reg
  return ''
endfunction

function! s:Repl()
    let s:restore_reg = @"
    return "p...@=restoreregister()\<cr>"
endfunction

" This supports "rp that permits to replace the visual selection with
" the contents of @r
vnoremap <silent> <expr> p <sid>Repl()

"------------------------------------------------------------------------

[1] This dozen lines is maintained there:
http://code.google.com/p/lh-vim/source/browse/misc/trunk/macros/repl-visual-no-reg-overwrite.vim

-- 
Luc Hermitte
http://lh-vim.googlecode.com/
http://hermitte.free.fr/vim/

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to