Reputation: 22596
Is there a vim command to replace something (a word, an inner object, a motion, etc) by a character but as many time as there are character to replace.
Exemple:
The cursor is at the beginning of the word foo
I want X and replace foo
by XXX
.
(I don't want to have to count the number of letter, so 3rX
is not a valid answer)
I don't want a script or a mapping, I just want to know if there is already a command to achieve that.
Upvotes: 3
Views: 270
Reputation: 104050
Similar to Colin's answer, but using the "inner word" selection lets you be less picky about the cursor position:
viwrX
visual inner word replace X
Upvotes: 4
Reputation: 20724
If you have the cursor at the beginning of a word then you can do the following:
Upvotes: 4
Reputation: 3364
I think this works:
verX
Of course the 'e' could be a different movement command.
Upvotes: 8