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. S
There is a great function for this: isearch-forward-symbol-at-point
. It highlights all occurrences of the word where your point is located - no need to place the point at the beginning of the word. Then you can move to next or previous with C-s or C-r.
Note that it is an exact match: if you use it on hi
it won't match chill
for instance.
I mapped if to command-f
(mac OSX): (global-set-key (kbd "s-f") 'isearch-forward-symbol-at-point)
in the init file.