1

One can use the matchadd function to add to groups of matches that will be highlighted in the VIM editor.

But how does one jump between the matches within a specific group?

3
  • 2
    You might be able to work with getmatches, but since matchadd takes a pattern I would either /pattern or :vimgrep /pattern/ %
    – D. Ben Knoble
    Mar 28, 2021 at 19:07
  • What are you trying to do? If you are trying to use syntax highlighting as a way to move in your buffer, Ben's comment is probably right: using the search of a grep command is easier. But if you are trying to do clever stuff with your syntax highlighting maybe :h getmatches() could be useful: it returns the matches you added with matchadd() so maybe you can use this command to get the patterns and then use these patterns in a search.
    – statox
    Mar 29, 2021 at 16:08
  • @statox I'm trying to highlight things in a log file and jump to them, but maybe in different colors...I know you can use different groups to highlight different colors.
    – leeand00
    Mar 29, 2021 at 17:05

0

Your Answer

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

Browse other questions tagged or ask your own question.