0

To get a view of all function definitions in a file I type :g/function/#

Vim displays each line with the word "function" in a small "message window". I'd like to have my defined syntax hightlighting applied to this output. Possible?

1 Answers1

1

Highlighting messages as output by :print and similar isn't possible.

But, you could

  1. capture the output of the command (:let output = execute('global/function/#')->split('\n'))
  2. display it in a popup window (or a regular new window) and add syntax highlighting

Alternately, :vimgrep function % (normally /function/, but since there are no pattern characters this is fine). Then use the quickfix features to navigate and have syntax highlighting directly in the actual buffer.

D. Ben Knoble
  • 26,070
  • 3
  • 29
  • 65