首页 > 代码库 > vim - copy a word

vim - copy a word

1. http://stackoverflow.com/questions/7797068/copying-a-word-and-pasting-over-a-word

viwp - visually select a word, and paste over it by something in the clip.

 

2. How to copy/delete word under cursor in Vim
http://www.littletechtips.com/2011/05/how-to-copydelete-word-under-cursor-in.html

Assuming the cursor is at the first character of the word in command mode:
yw (y for yank and w for word)

Other ways of doing the same thing which are not as efficient:
vey (v starts visual mode. e tells vim to move to end of word. y yanks or copies the word. to delete replace y with x.)

if the cursor is somewhere in the middle of the word, add a "b" (before) the command:
byw / bvey

vim - copy a word