O'Reilly logo

GNU Emacs Pocket Reference by Debra Cameron

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required