I often use #
key to quickly search for a keyword. I want to change the case of the last searched pattern in the easiest possible way.
One way to do this is to use \U\1
in the substitution part and pressing Ctrl-r
followed by /
in the search part of the standard substitution command, like this:
:%s/\(<Ctrl-r>/\)/\U\1/g
However, this is too unwieldy.
Is there some fast way to do this? That is, I press #
key and then 4-5 keystrokes later, I have changed the case of all the matches.
:%s//\U\1/g
an empty pattern uses the last search pattern. I am pretty sure we have a duplicate question on here, but I can't find it.:%s//\U\1/g
doesn't work. It simply deletes all the values matching the last searched pattern.\1
, use&
(or\0
, which is the same)