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)
Written by Adam Stankiewicz
Related protips
1 Response
I don't like remapping C-c
/C-v
. I'm using <Leader>y
and <Leader>p
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Vim
Authors
Related Tags
#vim
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#