sponsor Vim development Vim logo Vim Book Ad

basic Tip #356: Quick yank and paste

 tip karma   Rating 8/11, Viewed by 3274 

Read and edit this tip on the Vim tip wiki. The wiki may have a more recent version of this tip.

created:   October 30, 2002 12:54      complexity:   basic
author:   Niels Aan de Brugh      as of Vim:   5.7

Since I didn't want to interfere with the standard Vim mappings I removed all the <C-c>, <C-v>, etc. mappings found in the default vimrc. But quickly copy-pasting text is a must, so I added the following keymaps. This is very simple, but it works like a charm.

vmap <C-Space> "ay
nmap <C-Space> "aP
imap <C-Space> <C-o>"ap
nmap <C-c> "ayiw

Niels

My vimrc if you're interested: http://home.student.utwente.nl/n.h.m.aandebrugh/_vimrc

 rate this tip  Life Changing Helpful Unfulfilling 

<< Comment Lines according to a given filetype | Adding a console to gdbvim >>

Additional Notes

Anonymous, November 16, 2002 18:04
You might want to post that to http://www.dotfiles.com also. (And have a look around there of course.)
Breadman, July 31, 2003 20:15
I found the insertion mapping faulty: its behavior depended on whether I was at the end of the line.  The following work well for me:

vmap <C-c> "py
nmap <C-c> "pyiw
vmap <C-p> "pp
nmap <C-p> "pP
imap <C-p> <Esc>"ppa
If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Sponsored by Web Concept Group Inc. SourceForge.net Logo