emacs.d
emacs.d copied to clipboard
how to navigate highlight ?
when open a file in emacs buffer, i use "M-x highlight-regexp" to highlight some pattern。 how can i navigate through these highlight ?
Easy, find the line containng regular expression, double check the highlight text does have hi-xxxx
font face.
but how can i jump from one highlight text to next highlight text quickly? i know that swiper can help me do that, but swiper do not have highlight.
i want to first make the pattern highlight, then can easily go through these highlight. is there any convenient method to do so?
(defun regexp-next()
(interactive)
(re-search-forward (car regexp-history)))
Personally I will stick to swiper. What's real world problem you want to solve?
Actually I also have the same questions.
Given the following scenarios:
You have a log file that contains several key words that you're interested, and you highlighted them via hight-regexp
, and in investing the logs, you will often want to jump from one highlighted keyword to the next appearance of the same keyword(say to judge when an object is constructed/destructed .etc), while keep other highlighted keywords unchanged so that you can check other status.
For exact keyword match, in the above situation, we have ,ln (highlight-symbol-nav-mode)
to enable highlight navigation, and M-n (highlight-symbol-next)
or M-p (highlight-symbol-prev)
to jump back and forth. However, for regex match, the two commands mentioned above will not work.
Back to when I was using VIM, a vim plugin named mark
will do the trick, but I didn't find a counterpart in Emacs (yet).
interesting idea, maybe I can develop some solution