C-s | Start forward incremental search. |
C-r | Start reverse incremental search. |
When you are searching incrementally, each regular
character you type becomes part of the string you're
searching for. For example, C-s r
moves the cursor to the next r;
typing a moves the cursor to the
next occurrence of the string ra;
and so forth.
These characters have special meaning in incremental search mode:
enter | Stop searching and the leave the cursor where it is. |
C-g | Stop searching and move back to where the cursor was when you started searching. |
If you want to type the entire search string before
asking emacs to find it, type
C-s enter.
You will be prompted for the search string, and
when you press enter the second
time, the search will be executed. Non-incremental
reverse search works the same way, by typing
C-r enter.
To replace all occurrences of some old string with a
different string, type M-%. You
will prompted for the old string with the prompt
Query replace:; type the
old string and then press enter. You'll
then be prompted for the new string; type it and again
press enter.
At that time, if there are any occurrences of the old string in your file, the cursor will jump to the first occurrence. At that point you can type any of these characters:
space | Replace this one, then continue replacing. |
del | Don't replace this one, but continue. |
esc | Stop, don't replace any more, any leave the cursor where it is. |
, | Replace this one, but let me see the new text in place before going on. Type space when you are ready to go on. |
. | Replace this one, then stop. |
! | Replace all the rest of the old strings without asking. |