Skip to content

Instantly share code, notes, and snippets.

@starrhorne
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save starrhorne/149bce4ae24548442334 to your computer and use it in GitHub Desktop.
Save starrhorne/149bce4ae24548442334 to your computer and use it in GitHub Desktop.
" begin script to prevent pase over from replacing the default register
" contents
function! RestoreRegister()
let @" = s:restore_reg
return ''
endfunction
function! s:Repl()
let s:restore_reg = @"
return "p@=RestoreRegister()\<cr>"
endfunction
" NB: this supports "rp that replaces the selection by the contents of @r
vnoremap <silent> <expr> p <sid>Repl()
" END script to prevent pase over from replacing the default register
" contents
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment