diff options
author | Josh Rahm <rahm@google.com> | 2022-09-12 15:00:50 -0600 |
---|---|---|
committer | Josh Rahm <rahm@google.com> | 2022-09-12 15:00:50 -0600 |
commit | c055c2f90c7ed43ea61775f08d890a5de34a242e (patch) | |
tree | 0009924adfc813c9cae10bdaa32a70097325f64a /plugin/put.vim | |
parent | 4a2feecd03ce98e247fce5267534775718440c83 (diff) | |
download | fieldmarshal.vim-c055c2f90c7ed43ea61775f08d890a5de34a242e.tar.gz fieldmarshal.vim-c055c2f90c7ed43ea61775f08d890a5de34a242e.tar.bz2 fieldmarshal.vim-c055c2f90c7ed43ea61775f08d890a5de34a242e.zip |
put.vim,charadd.vim: add ability to change bindings
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 |