I can find the string I'm looking for by using Ctrl+s, but then I cannot figure out how to replace it at all. Even though there is something in the status bar that kind of seems like it's telling me how to replace, it's not clear enough for me and I cannot do it.

  • 1
    M-x replace-string? – Arkadiusz Drabczyk Sep 8 '19 at 18:55
  • I don't know how to use that. Where do I put the words that are supposed to be replaced? It keeps giving me a word that it wants to replace, but I didn't tell it to replace that word, and in fact, the word doesn't exist in the file. Please explain further how I'm supposed to use that. – Ramurb Idieh Sep 9 '19 at 2:17
  • Alt+s, type the word you want to replace, enter, type the word you want to replace it with, enter, then y for each instance. There might be more elegant ways, but that is what worked for me. – Ramurb Idieh Sep 9 '19 at 2:52

1) Find and replace can be done by the shortcut Alt + %, (in most of the keyboard layouts you will have to do Alt + Shift + 5)

2) Enter your search string and then [ret]followed by the string you want to replace your search string with and again [ret].

3) You can press y to replace a given instance of the search string or press n to keep it as it is, you can also press ! to replace all the occurrences of the search string (Shift + 1).

There are various other options available after step 2 which can be viewd by pressing the ? key (Shift + /).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.