Basic searching

This is a very basic tip, but is something we’ll come back to and build on.

To search for text in the buffer, use C-s and start typing a string to search forwards and C-r to search backwards. Repeatedly pressing C-s or C-r will move to the next/previous match.

A useful extra tip is that pressing C-s or C-r for a second time before entering your search string will reuse the previous search string.

In emacs, searching is useful finding occurrences of a string in a buffer, but also moving the cursor to a different place in the buffer to continue editing. For example, I might decide I wanted to move the cursor to the end of the word “repeatedly” in the first paragraph to make an edit. I can get their using e.g. C-r edly and hitting C-r a couple of times to move to that point. I then hit RET to end the search and the cursor is where I want it to be.

Remember that you can always use C-u C-SPACE to jump back to where you started you search after you are finished.

There are a lot of more advanced packages for searching and jumping around the buffer, and we’ll come to those in due course…