aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.vimrc19
1 files changed, 19 insertions, 0 deletions
diff --git a/.vimrc b/.vimrc
index 89b20fc..8b5b0f9 100644
--- a/.vimrc
+++ b/.vimrc
@@ -663,6 +663,25 @@ nnoremap <C-r> "
xnoremap <C-r> "
+" Paste clipboard content with 'paste' enabled
+function! s:paste_clipboard_content_with_paste_opt() abort
+ let old_paste = &paste
+ set paste
+ set pastetoggle=<Plug>(pastetoggle)
+ if old_paste
+ return "\<C-r>+"
+ else
+ " 'paste' was off when the function was called. Then, 'paste' will be
+ " disabled via 'pastetoggle'.
+ return "\<C-r>+\<Plug>(pastetoggle)"
+ endif
+endfunction
+
+" Automatically enable 'paste' and disable it after pasting clipboard's
+" content.
+inoremap <expr> <C-r>+ <SID>paste_clipboard_content_with_paste_opt()
+
+
let @j = 'j.'
let @k = 'k.'
let @n = 'n.'