I have a syntax highlight, that is presumably overwritten by another script. When I execute :scriptnames, it shows ~90 scripts. The syntax script is around number 40.

Is it possible to manually load the scripts that would otherwise be loaded automatically? This would allow me to detect the script that overwrites my highlight.

  • 2
    You could do something like vim -Nu NONE and then source things in the order you want... but using .vim/after/... might fix your issue without tracking that down? Or you could try to grep all your vim files for the relevant code – D. Ben Knoble Oct 7 '20 at 13:35
  • Grepping sadly is not viable, because the code is some kind of regex. I tried vim/after/syntax/c.vim which did load and also worked, however it was also loaded around place 40 of 90. Maybe sourcing it with your first suggestion is what I have to do, but I'll have to look deeper into that. Thank you. – earthling Oct 7 '20 at 14:01
  • 2
    You could also use one of several approaches to get the syntax item under the cursor and grep for that (easier than grepping for an escaped regex) – D. Ben Knoble Oct 7 '20 at 14:57
  • 2
    did you try :verbose :hi <your_group>? – Christian Brabandt Oct 8 '20 at 5:34
  • @ChristianBrabandt: I did now, vim recognizes the group, which is highlight binary_number ctermfg=175 guifg=#00ffff. This is the group: syntax match binary_number /\v<0b[01]+>/, which is both stored in .vim/syntax/c.vim. Other regexes in this file work. When I type out the regex and the highlight manually in vim, it works fine. So I figure it is overwritten somewhere. – earthling Oct 8 '20 at 6:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.