소스 검색

add mapping to swap default register with another - especially useful to put yanked text onto the clipboard

Daniel Sheffield 2 주 전
부모
커밋
96bb51f4f0
1개의 변경된 파일8개의 추가작업 그리고 0개의 파일을 삭제
  1. 8 0
      vim/vimfiles/vimrc

+ 8 - 0
vim/vimfiles/vimrc

@@ -67,6 +67,14 @@ set wildmenu
 set encoding=utf-8
 scriptencoding utf-8
 
+" Copy Pasta {{{
+function! RegisterSwapDefaultWith()
+    let l = nr2char(getchar())
+    execute 'let @x=@' . l . '| let @' . l . '=@" | let @"=@x'
+endfunction
+nnoremap <Leader>c :call RegisterSwapDefaultWith()<CR>
+nnoremap <Leader>C :let @x=@+ \| let @+=@" \| let @"=@x<CR>
+" }}}
 
 " Formatting {{{