diff options
Diffstat (limited to 'plugin/put.vim')
-rw-r--r-- | plugin/put.vim | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/plugin/put.vim b/plugin/put.vim index 2240454..7133fd6 100644 --- a/plugin/put.vim +++ b/plugin/put.vim @@ -14,9 +14,19 @@ " Notably, this command does not alter the contents of the default register, so " this command may be repeated without worry for changing the editor state. -noremap <silent> cp <cmd>call <sid>setcpreg(v:register)<bar>set operatorfunc=<sid>put<cr>g@ -noremap <silent> cpp <cmd>call <sid>setcpreg(v:register)<bar>set operatorfunc=<sid>put<cr>g@_ -noremap <silent> cP <cmd>call <sid>setcpreg(v:register)<bar>set operatorfunc=<sid>put<cr>g@$ +if !exists('g:put_include_bindings') + let g:put_include_bindings = 1 +endif + +noremap <silent> <Plug>(copy-put) <cmd>call <sid>setcpreg(v:register)<bar>set operatorfunc=<sid>put<cr>g@ +noremap <silent> <Plug>(copy-put-line) <cmd>call <sid>setcpreg(v:register)<bar>set operatorfunc=<sid>put<cr>g@_ +noremap <silent> <Plug>(copy-put-end) <cmd>call <sid>setcpreg(v:register)<bar>set operatorfunc=<sid>put<cr>g@$ + +if g:put_include_bindings + noremap cp <Plug>(copy-put) + noremap cpp <Plug>(copy-put-line) + noremap cP <Plug>(copy-put-end) +endif " Like 'p', but in visual mode doesn't clobber the "-register. If invoked with a " register, the replaced text is put in the given register. @@ -49,7 +59,8 @@ function! s:put(arg, ...) abort endif let save = getreg('"') + let savetyp = getregtype('"') silent! exec printf("norm %s\"%sp", vis, s:cpbuf) - call setreg('"', save) + call setreg('"', save, savetyp) endfunction |