diff options
author | Lewis Russell <lewis6991@gmail.com> | 2023-01-17 16:56:23 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-17 16:56:23 +0000 |
commit | 20b7be2d1024b6e9eac68e0cb92cf663e95e51ca (patch) | |
tree | d7ab0abcb12995e2e19722b8d1fe49fbf49f0cb2 /runtime/lua/vim/treesitter/highlighter.lua | |
parent | 0344bfad0fc87d2e256ea2b80de7abd069ba1dd2 (diff) | |
download | rneovim-20b7be2d1024b6e9eac68e0cb92cf663e95e51ca.tar.gz rneovim-20b7be2d1024b6e9eac68e0cb92cf663e95e51ca.tar.bz2 rneovim-20b7be2d1024b6e9eac68e0cb92cf663e95e51ca.zip |
fix(treesitter): really restore syntax
- also unset b:ts_highlight on stop()
Fixes: #21836
Diffstat (limited to 'runtime/lua/vim/treesitter/highlighter.lua')
-rw-r--r-- | runtime/lua/vim/treesitter/highlighter.lua | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/runtime/lua/vim/treesitter/highlighter.lua b/runtime/lua/vim/treesitter/highlighter.lua index e99994c8a9..d77a0d0d03 100644 --- a/runtime/lua/vim/treesitter/highlighter.lua +++ b/runtime/lua/vim/treesitter/highlighter.lua @@ -88,7 +88,6 @@ function TSHighlighter.new(tree, opts) end end - self.orig_syntax = vim.bo[self.bufnr].syntax self.orig_spelloptions = vim.bo[self.bufnr].spelloptions vim.bo[self.bufnr].syntax = '' @@ -120,8 +119,11 @@ function TSHighlighter:destroy() end if vim.api.nvim_buf_is_loaded(self.bufnr) then - vim.bo[self.bufnr].syntax = self.orig_syntax vim.bo[self.bufnr].spelloptions = self.orig_spelloptions + vim.b[self.bufnr].ts_highlight = nil + if vim.g.syntax_on == 1 then + a.nvim_exec_autocmds('FileType', { group = 'syntaxset', buffer = self.bufnr }) + end end end |