This post started as a quick note (mainly to myself) about a handy sub-feature within emacs find. Since reading through the documentation, I need to mention a few other sub-features too.
As I’ve probably mentioned before, I use both vim and emacs. One great feature of vim is that if you press # or * it searches for the word that your cursor is over. # or * choose a backwards or forwards search respectively.
There is a similar convenience when using emacs search in that if you enter search using C-s then C-w chooses the word you are looking at. I always forget about this feature and my google-fu is never good enough to find it again. Fortunately I recently came across it again when I was looking at the documentation for C-s (isearch-forward) using C-h k C-s.
It turns out that isearch is implemented by a minor mode (logically enough when you think about it) that adds a whole bunch of useful keys, including C-w we mentioned earlier. Other notable features are:
C-M-wdelete last character in search stringM-rtoggle regular-expression modeM-eedit search string
And to replace search strings there are:
M-%query-replace andC-M-%query-replace-regexp