Is there a way in Vim to save the window that comes up if you type :highlight
? I'm working on a color scheme and it would be helpful to be able to have a copy of it open in a real window (so I can search, or delete lines once I've taken care of them in my color scheme). I've already tried :h :highlight
, which doesn't turn up anything useful, but surely there must be a way. Thanks!
You can use redir
to redirect the output of highlight to a file.
In vim you run
:redir > file
:highlight
:redir END
file should now contain the output of highlight.
Update: One way to highlight the xxx
in the highlight file is to run the function below
function! HiFile()
let i = 1
while i <= line("$")
if strlen(getline(i)) > 0 && len(split(getline(i))) > 2
let w = split(getline(i))[0]
exe "syn match " . w . " /\\(" . w . "\\s\\+\\)\\@<=xxx/"
endif
let i += 1
endwhile
endfunction
The function uses syn match
to match the highlight group with the xxx
after it.
You can place the function in your vimrc and then to run it type :call HiFile()
while in the highlight file.
There's a menu command Syntax > Highlight Test that creates a buffer with all highlight groups. Alternatively, you can trigger it via
:runtime syntax/hitest.vim
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With