Is there a fast way of changing the case of the last searched pattern?
Inside Evil
mode, I press #
key to quickly search for keywords at point. And I want to change the case of all occurences of that keyword.
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.
Sign up to join this communityIs there a fast way of changing the case of the last searched pattern?
Inside Evil
mode, I press #
key to quickly search for keywords at point. And I want to change the case of all occurences of that keyword.
Okay, I found the answer using Evil mode. After issuing the search using #
key in Evil mode, just issue this substitution command:
:%s//\U&/g
Here, %s
is for substitution, //
means that it will use the last searched pattern, /\U&/
means it will upper-case (\U
) the complete match (&
), and g
is for global, i.e. substitute all the matches.
For a vanilla Emacs approach, you might use:
isearch-case-fold-search
enabled by default).You can try q ?
: this will open a small buffer with your last searches using #
(and ?
) and then you can edit in-place the last command used and press Enter to execute that search