I use emacs for viewing and editing code and other text files. I wanted to know if there is a way to search forward or backward for text which is marked in the current buffer. Similar to what I can do in notepad or wordpad. As in can I mark some text in the buffer and do a C-s or C-r and be able to search with the marked text without actually typing in the whole search text?
Thank you,
Rohit
@Alex nails it.
Another option I use quite often is C-s C-w
to search for the word after the current mark. Hitting C-w
repeatedly increases the search with additional words (e.g., C-s C-w C-w C-w
searches for the 3 words after the current mark).
Similarly, C-s M-s C-e
searches for the rest of the line after the current mark and C-s C-M-y
searches for the character after the mark. These are both repeatable in the same way (the former by somewhat-awkwardly repeating M-s C-e
after C-s
).