Reputation: 9508
Let's say I have a piece of text within my code which I want duplicated.
What I've been doing so far is to move to the start, press v
to enter visual mode, then move to the end, press y
to yank the text, move one character back and then p
to put it there.
Is there an easier way? Something like:
v
.Upvotes: 1
Views: 216
Reputation: 77454
You can always define custom macros / shortcuts on the fly.
map ! "+yP
will allow you to enter visual with v
, mark the text, and use !
to duplicate it once (for extra duplicates, repeat p
or P
as needed.
Upvotes: 2
Reputation: 206659
If it's the "move one char back" you're trying to avoid, press P
rather than p
for the "paste" operation.
Upvotes: 6