Last Updated: February 25, 2016
· sheerun

Natural copying and pasting in Vim


Add to your .vimrc:

vnoremap <silent> y y`]
vnoremap <silent> p p`]
nnoremap <silent> p p`]

vmap <silent> <C-c> "+y
nmap <silent> <C-c> "+yy
vmap <silent> <C-v> "+p
imap <silent> <C-v> <Esc>"+pa

This does two things:

  • Cursor is placed at the and of yanked / pasted text
  • You can use Ctrl-C and Ctrl-V for system clipboard interaction (it doesn't change Ctrl-V in normal mode, use o C-v to paste code)

1 Response
Add your response


I don't like remapping C-c/C-v. I'm using <Leader>y and <Leader>p

over 1 year ago ·