diff options
| author | nsfisis <nsfisis@gmail.com> | 2020-09-14 15:08:34 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2020-09-14 15:08:34 +0900 |
| commit | 0f436fa5e5491a03b3369c1980d8d9245f3cae23 (patch) | |
| tree | a1a2af8dc8bb26e6b6954b6104fa9c1038efb1c0 | |
| parent | 44fe00b8275e8d20871e42917b873ce9aa8001f1 (diff) | |
| download | dotfiles-0f436fa5e5491a03b3369c1980d8d9245f3cae23.tar.gz dotfiles-0f436fa5e5491a03b3369c1980d8d9245f3cae23.tar.zst dotfiles-0f436fa5e5491a03b3369c1980d8d9245f3cae23.zip | |
Update .vimrc: auto-toggle 'paste'
| -rw-r--r-- | .vimrc | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -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.' |
