diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-07-03 07:40:42 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-03 07:40:42 +0800 |
commit | d413038b4fd71b7a335b6653aa64d2cb6daeac7b (patch) | |
tree | 6f6cc9e09bb6a3b4aecdb64d761bc93e5730dd88 /runtime/lua/vim/treesitter/highlighter.lua | |
parent | aec7f1979ada1b34cfb3d8fd33769232d0323ea8 (diff) | |
download | rneovim-d413038b4fd71b7a335b6653aa64d2cb6daeac7b.tar.gz rneovim-d413038b4fd71b7a335b6653aa64d2cb6daeac7b.tar.bz2 rneovim-d413038b4fd71b7a335b6653aa64d2cb6daeac7b.zip |
fix(treesitter): ensure syntaxset augroup exists (#29542)
Problem:
Error when calling vim.treesitter.start() and vim.treesitter.stop() in
init.lua.
Solution:
Ensure syntaxset augroup exists after loading synload.vim.
Diffstat (limited to 'runtime/lua/vim/treesitter/highlighter.lua')
-rw-r--r-- | runtime/lua/vim/treesitter/highlighter.lua | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/runtime/lua/vim/treesitter/highlighter.lua b/runtime/lua/vim/treesitter/highlighter.lua index 052b839609..a94c408f4e 100644 --- a/runtime/lua/vim/treesitter/highlighter.lua +++ b/runtime/lua/vim/treesitter/highlighter.lua @@ -139,8 +139,11 @@ function TSHighlighter.new(tree, opts) -- but use synload.vim rather than syntax.vim to not enable -- syntax FileType autocmds. Later on we should integrate with the -- `:syntax` and `set syntax=...` machinery properly. + -- Still need to ensure that syntaxset augroup exists, so that calling :destroy() + -- immediately afterwards will not error. if vim.g.syntax_on ~= 1 then vim.cmd.runtime({ 'syntax/synload.vim', bang = true }) + vim.api.nvim_create_augroup('syntaxset', { clear = false }) end vim._with({ buf = self.bufnr }, function() |