What's happened to lua syntax in NVIM v0.10.0?

  • Win10Pro laptop: I just upgraded to nvim v0.10.0 and now:
    1. my after\syntax\lua.vim is no longer sourced (but my other after\syntax are)
    2. in any *.lua, even in a minimal test configuration, :syntax returns nothing, even though the *.lua* is clearly showing correct highlighting (:syntax in any other file type returns information as expected)
  • Arch Linux I’m still on neovim 0.9.5 (but not for long - it’s been flagged out of date) and :syntax works normally in a *.lua

Something weird’s now going on with lua syntax sourcing. Any ideas?

Just upgraded on Void linux to 0.10. Looks like Lua files now use treesitter highlighting by default. Try running :=vim.treesitter.stop() in a Lua buffer and then check that :syntax returns the usual output. There should probably be a way to disable this completely if you want, but I wasn’t able to find it. Alternatively, if you still want custom changes to Lua highlighting, you could look into using treesitter .scm grammar files instead of the vimscript syntax files. I hope that helps.

1 Like

Thanks! I’ve chosen to have a generalised mapping to switch off use of highlights.scm for a buffer:

vim.keymap.set({'n'},'<localleader>t',function()vim.treesitter.stop()end,{desc='disable Neovim\'s treesitter highlights.scm'})

I don’t use lua AFAIK in nVim.
I’m running the latest nVim v0.10.0 on the latest Arch and I spent 4 hours yesterday trying to work out what had happened to my default text formatting.

I didn’t find the answer within .vimrc (symlinked) for nVim.

I have done a fair bit of googling and can’t find an explantion for these changes.

The above solutions do not work for me.
What is treesitter ?

I would simply like to undo whatever the new version has done to make these undesired changes.

Went down a rabbit hole re-learning installing colour themes via plugins.
But did not manage to find a theme plugin to return my text colour settings to the way they were previously before the update, eg with line numbering vertical column on the left in yellow colour text.

How do I get my old default text settings back ?

Found the answer here

To restore previous default colour scheme, add

colorscheme vim
or
:source $VIMRUNTIME/colors/vim.lua

to .vimrc

I don’t think it is indentical to what it was, but it will do.

I think this will only work if your colorscheme doesn’t do hi clear at the top. See also this issue. You could probably add that line to the colorscheme though to get back to how it was before? For treesitter, see :h treesitter. It is an alternative way to parse code into a syntax tree, and is used in 0.10 by default for syntax highlighting (of lua files by default, others if you install the tree-sitter binary and the parsers for the language, which is made easier with nvim-treesitter plugin).

1 Like