Search code examples
searchemacsspacemacsisearch

Emacs isearch symbol backwards/forwards using Ctrl-Arrows


How can I have Ctrl-Left/Right search forwards/backwards for the symbol under the cursor?

I can't seem to find a way to search forwards/backwards on a symbol using just a single key. Spacemacs had this functionality for a while and likely came from evil mode.

Thanks


Solution

  • Turns out the package 'highlight-symbol' has this functionality. Ironically, it does not highlight the search symbol...

    ;; Alt-Left/Right jumps to prev/next symbol
    (require 'highlight-symbol)
    (global-set-key (kbd "<M-right>") 'highlight-symbol-next)
    (global-set-key (kbd "<M-left>") 'highlight-symbol-prev)