3

I would like the "search" from search and replace, to be the selected region.

Is there a command doing that already ?

nicolas
  • 177
  • 1
  • 8
  • 1
    Are you aware of the package iedit? This might be an option if you want to replace all occurrences of the currently selected region in the whole or narrowed buffer. – andrej Dec 02 '18 at 09:38
  • @Andrej this looks nice. of course it's already installed on my emacs and I don't know it :)) I think I'll use it, Configuration is powerful, but Convention (as defined by other editors) has a lot of benefit ;) – nicolas Dec 02 '18 at 11:48

1 Answers1

3

You can do this after selecting text to make it the active region:

  1. M-w, to copy the selected text to the kill-ring, so it can be yanked (pasted).

  2. 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.)

Drew
  • 77,472
  • 10
  • 114
  • 243
  • 1
    That is, unfortunately, probably the simplest answer. 30 years ago I did not understand why people used yanked and not paste, or used Stg+x/c/v by default. I know its not you, but I still do not see the point – nicolas Dec 01 '18 at 19:14