When I type :highlight, I get a buffer like:
:highlight
SpecialKey xxx term=bold ctermfg=188 guifg=#dcdfe4
EndOfBuffer xxx links to NonText
NonText xxx term=bold ctermfg=239 guifg=#373C45
Directory xxx term=bold ctermfg=75 guifg=#61afef
ErrorMsg xxx term=standout ctermfg=188 guifg=#dcdfe4
IncSearch xxx term=reverse ctermfg=236 ctermbg=180 guifg=#282c34 guibg=#e5c07b
Search xxx term=reverse ctermfg=236 ctermbg=180 guifg=#282c34 guibg=#e5c07b
CurSearch xxx links to Search
MoreMsg xxx term=bold ctermfg=188 guifg=#dcdfe4
ModeMsg xxx term=bold ctermfg=188 guifg=#dcdfe4
LineNr xxx term=underline ctermfg=247 ctermbg=236 guifg=#919baa guibg=#282c34
LineNrAbove xxx cleared
...
This buffer is multiple pages, and I can scroll through them just fine, but I want to be able to search through all the highlight commands in order to find what I'm looking for (e.g. to answer questions like "why aren't python methods being highlighted", or "what's the name of this popup that's being highlighted a specific red colour").
When I type /, I get this line that seems to indicate I can't use / for searching:
-- More -- SPACE/d/j: screen/page/line down, b/u/k: up, q: quit
Is there a way to search this buffer?
Is there a way to search this buffer?
No. There is no way to search that wall of text, mostly because it is not actually a buffer to begin with. See :help more-prompt.
But you can use :help :filter to print the filtered lines in the command-line:
:filter Cursor highlight
The output is transient, though, so it might not be very useful for your use case.
NOTE: :filter is the only method that keeps whatever highlighting was used for the command's output. The other methods turn that output in plain text so there is no easy way to put those colors back.
You can also use :redir, as hinted by @Friedrich:
:redir @a
:hi
:redir END
:vnew
"ap
/Cursor
which is quite involved for such a seemingly simple task. See :help :redir.
Another low-level method is to use :put with the "expression register" in a new window:
:vnew
:0put=execute('highlight')
/Cursor
See :help :put, :help "=, and :help execute().
FWIW, I recently turned an old Gist of mine into a minimal-yet-proper plugin that abstracts all of that away with a streamlined process:
:Redir verbose hi
/Cursor
Or:
:Redir hi | v/Cursor/d
See :help :v.
If you want to take that road, be sure to check the various spin-offs mentioned in the comments of the original gist.