7

I just noticed this today and don't have a link to any official status changes that indicate this would be supported.

I think you can use lang-vimscript after a triple-backtick code fence to get highlighting (it doesn't seem to be working on this meta site, but should work on the main site).

11
  • 1
    Oh nice! Annoyingly, I've been marking up all mine with vim since they changed highlighting backends. (Can't remember why I thought that would end up being the supported syntax, but I definitely had some reason for it.)
    – Rich
    Oct 30, 2023 at 16:17
  • Is this just a synonym for lang-vim or do they differ in anything?
    – Friedrich
    Nov 2, 2023 at 8:54
  • 1
    @Friedrich frankly I have no idea. I’ll ask around.
    – D. Ben Knoble Mod
    Nov 2, 2023 at 16:30
  • After a little trial and error, I haven't noticed any difference between lang-vim and lang-vimscript. What I did notice was that " is always interpreted as belonging to a string, not a comment which makes properly commented code awkward to read. Is there any place where one could report this bug?
    – Friedrich
    Nov 6, 2023 at 7:37
  • Is it for vim9 or for vim8. I have used it at this answer and the result looks odd. Nov 6, 2023 at 9:32
  • @VivianDeSmedt the "zebra" comments are caused by quotes being evaluated in pairs as string delimiters as I commented above. Other than that, your post looks almost okay. Would be nice if e.g. endif was recognized as a keyword, too.
    – Friedrich
    Nov 6, 2023 at 9:39
  • 1
    @VivianDeSmedt I hijacked your answer and appended quotes to every comment line. It looks a bit more reasonable now (apart from my superfluous quotes, obviously).
    – Friedrich
    Nov 6, 2023 at 9:52
  • 1
    Thanks @Friedrich my goal was to know or to exemplify how much the lang-vimscript seems not to be working. Nov 6, 2023 at 10:01
  • 2
    @Friedrich bugs go to highlight.js: meta.stackexchange.com/questions/184108/…
    – D. Ben Knoble Mod
    Nov 6, 2023 at 13:25
  • Seems highlight.js works fine on its own so I asked on meta: Syntax highlighting for Vimscript.
    – Friedrich
    Nov 6, 2023 at 22:00
  • According to this answer it seems vimscript is not yet supported or at least the hint is not. Nov 7, 2023 at 4:14

1 Answer 1

3

Unfortunately, lang-vimscript and lang-vim are not supported. It looks like they were supported, but they're not.

See this answer for Language codes currently available on Stack Exchange. It is updated when new languages are added and (at the time of this writing) there's no vim on the entire page.

Short explanation

When SE does not know a language hint, it will just silently pick one on it's own. In Vivian's answer, it randomly goes for C# highlighting. This is a known problem across SE sites: Stop guessing/auto-detecting a language when you KNOW it will be incorrect

Quoting from above question

It makes users think a language is supported when it is not

I couldn't agree more.

Long explanation

See my question on meta: Syntax highlighting for Vimscript and the answer given by zcoop98.

Zcoop98 suggested making a "formal request" for Vimscript to be added but chances seem to be slim. I'll see what I can do.

By the way, highlight.js does support lang-vim (with some quirks) so it's just a matter of enabling that feature on SE.

Conclusion

For now, I think it's better to go without any language hint. No highlighting is still preferable to wrong highlighting.

1
  • 1
    I’ve edited the OP to be less confusing in light of this. Thanks for the research
    – D. Ben Knoble Mod
    Nov 7, 2023 at 14:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .