I'm using :helpg session in my Vim.

I would like to highlight the pattern in the results like :set hls does for normal search.

Is there a way to do this?

  • What did you try?
    – romainl
    Oct 4, 2023 at 15:01
  • @romainl for example I want to use :helpgrep word1.*word4 :helpgrep word1\|word4 and I need to highlight these words. Oct 4, 2023 at 15:37
  • That's what you want to do. I'm asking what you tried to do to achieve that.
    – romainl
    Oct 4, 2023 at 16:01
  • @romainl I have no idea ): Oct 4, 2023 at 16:17
  • Whenever you jump to one of the matches, your cursor is exactly on the word. It should be visible. To highlight additional matches, you could just press * to go to the next match (thereby triggering highlight).
    – Friedrich
    Oct 4, 2023 at 20:05

1 Answer 1


I would use the match command:

" Open the quickfix buffer
" Use 'Search' highlighting group to highlight your pattern
:match Search /word1.*word4/

If you frequently perform these actions, you could create a custom command to combine them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.