Re:A Vim Guide for Advanced Users
by simias on Saturday February 27, 2021 @11:33AM
(#26285891)
Oh man, I knew there had to be a way to do that but I couldn't find it, so I always resorted to counting the number of characters in the match and then use cl<num> to replace it if there was no convenient motion like some kind of barbarian.
[ Parent
| on HN ]
Re:A Vim Guide for Advanced Users
by bobbyi_settv on Saturday February 27, 2021 @11:48AM
(#26286010)
The non-barbarian way to avoid counting characters when there's no convenient motion is visual mode. Hit v, then hit l until you've highlighted the part you want to change, then hit c to start changing it.
Oh I never thought about that either. Thank you.
Re:A Vim Guide for Advanced Users
by bobbyi_settv on Saturday February 27, 2021 @02:32PM
(#26287464)
I rarely actually do it because f and t motions, possibly with a number, can usually handle these cases. For example, c3tA to change up to but not including the third capital A after the current position
If it's more than one 'A' I'd use visual mode. I'm always impressed people can accurately count up to like three ;)