I would like the "search" from search and replace, to be the selected region.
Is there a command doing that already ?
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 communityYou can do this after selecting text to make it the active region:
M-w
, to copy the selected text to the kill-ring
, so it can be yanked (pasted).
C-s M-y
, to start search (C-s
) and yank the last-copied entry of the kill-ring
, which is your selected text.
(Just before or after M-w
you may want to use C-x C-x
to move the cursor to the other end of the selected text, depending on which end it was at to start with. That is, if you want to start your search before that occurrence of the text that was selected, and not after it.)
iedit
? This might be an option if you want to replace all occurrences of the currently selected region in the whole or narrowed buffer.