I use the highlight mode in vim to copy a few characters. I then want to paste more than once. My current technique does not work well.
Sample text: Linux Solaris Irix HP-UX
Suppose I want to copy the word Linux
, then paste over Solaris
and Irix
.
- Place cursor at
L
inLinux
- Command
v
(for visual hilite), thene
(for end-of-word), theny
(for yank/copy) - Now
Linux
is on my "vim clipboard" - Move cursor to
S
inSolaris
(first instance) - Command
v
(for visual hilite), thene
(for end-of-word), thenp
(for paste) - Text is now:
Linux Linux Irix HP-UX
, but nowSolaris
is on my "vim clipboard" - Move cursor to
I
inIrix
(second instance) - Command
v
(for visual hilite), thene
(for end-of-word), thenp
(for paste) - Text is now:
Linux Linux Solaris HP-UX
which is not what I expected.
I resort to using highlite/paste with the mouse (via X Terminal). Surely, I can do this better. How?
Best Answer
I would do that in this way (really useful for many paste):
Linux
, then "ayiw to copy the wordHint: Replace the w by W in qbdiw"aPq to select word with punctuation, like
HP-UX
Issue: When the word is the last in the line it will delete the space before the word.