aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-07-03 15:24:12 +0800
committerGitHub <noreply@github.com>2024-07-03 15:24:12 +0800
commit12c9791e0fef7ee0d6cf6d3b828caa488d6347ea (patch)
tree8ef3c4199a525154f299a2a59b86b1e453554bd7
parent599fc7cee4441cf3beacd47f388aa36194091422 (diff)
downloadrneovim-12c9791e0fef7ee0d6cf6d3b828caa488d6347ea.tar.gz
rneovim-12c9791e0fef7ee0d6cf6d3b828caa488d6347ea.tar.bz2
rneovim-12c9791e0fef7ee0d6cf6d3b828caa488d6347ea.zip
fix(runtime): stop treesitter highlight in b:undo_ftplugin (#29533)
It seems that nvim-treesitter stops treesitter highlight when changing filetype, so it makes sense for builtin ftplugins to do this as well. Use :call and v:lua here to allow separation with '|'.
-rw-r--r--runtime/ftplugin/help.lua1
-rw-r--r--runtime/ftplugin/lua.lua2
-rw-r--r--runtime/ftplugin/query.lua5
-rw-r--r--runtime/indent/query.lua4
-rw-r--r--runtime/syntax/query.lua4
5 files changed, 10 insertions, 6 deletions
diff --git a/runtime/ftplugin/help.lua b/runtime/ftplugin/help.lua
index 0628a3e9ca..6e643c967f 100644
--- a/runtime/ftplugin/help.lua
+++ b/runtime/ftplugin/help.lua
@@ -31,4 +31,5 @@ vim.keymap.set('n', 'gO', function()
require('vim.vimhelp').show_toc()
end, { buffer = 0, silent = true })
+vim.b.undo_ftplugin = vim.b.undo_ftplugin .. ' | call v:lua.vim.treesitter.stop()'
vim.b.undo_ftplugin = vim.b.undo_ftplugin .. ' | nunmap <buffer> gO'
diff --git a/runtime/ftplugin/lua.lua b/runtime/ftplugin/lua.lua
index 98f218e36e..27ebafa196 100644
--- a/runtime/ftplugin/lua.lua
+++ b/runtime/ftplugin/lua.lua
@@ -1,2 +1,4 @@
-- use treesitter over syntax
vim.treesitter.start()
+
+vim.b.undo_ftplugin = vim.b.undo_ftplugin .. ' | call v:lua.vim.treesitter.stop()'
diff --git a/runtime/ftplugin/query.lua b/runtime/ftplugin/query.lua
index 499619e36f..945d441971 100644
--- a/runtime/ftplugin/query.lua
+++ b/runtime/ftplugin/query.lua
@@ -1,6 +1,6 @@
-- Neovim filetype plugin file
-- Language: Treesitter query
--- Last Change: 2023 Aug 23
+-- Last Change: 2024 Jul 03
if vim.b.did_ftplugin == 1 then
return
@@ -32,6 +32,7 @@ if not vim.b.disable_query_linter and #query_lint_on > 0 then
end
-- it's a lisp!
-vim.cmd([[ runtime! ftplugin/lisp.vim ]])
+vim.cmd([[runtime! ftplugin/lisp.vim]])
vim.b.undo_ftplugin = vim.b.undo_ftplugin .. ' | setl omnifunc< iskeyword<'
+vim.b.undo_ftplugin = vim.b.undo_ftplugin .. ' | call v:lua.vim.treesitter.stop()'
diff --git a/runtime/indent/query.lua b/runtime/indent/query.lua
index 3261376d87..c5b4f1f03d 100644
--- a/runtime/indent/query.lua
+++ b/runtime/indent/query.lua
@@ -1,6 +1,6 @@
-- Neovim indent file
-- Language: Treesitter query
--- Last Change: 2022 Mar 29
+-- Last Change: 2024 Jul 03
-- it's a lisp!
-vim.cmd([[ runtime! indent/lisp.vim ]])
+vim.cmd([[runtime! indent/lisp.vim]])
diff --git a/runtime/syntax/query.lua b/runtime/syntax/query.lua
index 1e129dbeff..2dfe29f69b 100644
--- a/runtime/syntax/query.lua
+++ b/runtime/syntax/query.lua
@@ -1,6 +1,6 @@
-- Neovim syntax file
-- Language: Treesitter query
--- Last Change: 2022 Apr 13
+-- Last Change: 2024 Jul 03
-- it's a lisp!
-vim.cmd([[ runtime! syntax/lisp.vim ]])
+vim.cmd([[runtime! syntax/lisp.vim]])