How to highlight all occurrences of a word in an Emacs buffer?

后端 未结 13 1016
执念已碎
执念已碎 2020-12-12 11:56

Notepad++ has a convenient feature: if you select a word in your text (not necessarily a keyword), the word is highlighted throughout the text. Can this be done in Emacs as

13条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-12 12:38

    This may not be as nice as what you were hoping but if you put

    (global-hi-lock-mode 1)
    

    in your .emacs file then you can type C-x w h REGEX to highlight all occurances of REGEX, and C-x w r REGEX to unhighlight them again. Again, not as elegant as you'd probably like, but it'll work.

提交回复
热议问题