1.3. Search and Replace Operations
1.3.1. Incremental Search
An incremental search begins when you type the first letter and continues searching as you add characters.
To | Keystrokes Command Name |
---|---|
Incremental search forward | C-s isearch-forward |
Incremental search backward | C-r isearch-backward |
Exit incremental search | RETURN |
Cancel incremental search | C-g keyboard-quit |
Delete incorrect character of search string | DEL |
1.3.2. Nonincremental and Word Search
Emacs provides a plain vanilla search, in which you type the whole word, then start the search. It also offers a word search. This search finds whole words and can find phrases spread across line breaks.
To | Keystrokes |
---|---|
Search forward | C-s RETURN |
Search backward | C-r RETURN |
Word search | C-s RETURN C-w |
1.3.3. Query Replace
To | Keystrokes Command Name |
---|---|
Enter query-replace | ESC % query-replace |
Replace and go on to the next instance | SPACE or y |
Don't replace; move on to next instance | DEL or n |
Replace the current instance and quit | . |
Replace and pause (SPACE or y to move on) | , |
Replace the rest and don't ask | ! |
Back up to the previous instance | ^ |
Exit query-replace | RETURN or q |
Enter recursive edit | C-r |
Delete this instance and enter a recursive edit | C-w |
Exit recursive edit and resume query-replace | ESC C-c |
Exit recursive edit and exit query-replace | C-] |
1.3.4. Regular Expression Search and Replace
This section lists characters for creating regular expressions, followed by commands for replacement operations ...
Get GNU Emacs Pocket Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.