aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/vim_diff.txt6
-rw-r--r--runtime/lua/vim/filetype/detect.lua3
-rw-r--r--runtime/lua/vim/shared.lua9
-rw-r--r--runtime/lua/vim/treesitter.lua6
-rw-r--r--runtime/lua/vim/treesitter/highlighter.lua9
5 files changed, 18 insertions, 15 deletions
diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt
index 5c1725a1f8..229ed95826 100644
--- a/runtime/doc/vim_diff.txt
+++ b/runtime/doc/vim_diff.txt
@@ -78,7 +78,6 @@ centralized reference of the differences.
- |g:vimsyn_embed| defaults to "l" to enable Lua highlighting
-
Default Mouse ~
*default-mouse* *disable-mouse*
By default the mouse is enabled, and <RightMouse> opens a |popup-menu| with
@@ -99,7 +98,10 @@ the following:
\ autocmd CursorMoved * ++once set mouse&<Bar>
\ echo 'mouse ON'<CR>
<
-
+To remove the "How-to disable mouse" menu item and the separator above it: >vim
+ aunmenu PopUp.How-to\ disable\ mouse
+ aunmenu PopUp.-1-
+<
Default Mappings ~
*default-mappings*
Nvim creates the following default mappings at |startup|. You can disable any
diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua
index a5f20b61a6..ee538dc8c7 100644
--- a/runtime/lua/vim/filetype/detect.lua
+++ b/runtime/lua/vim/filetype/detect.lua
@@ -1097,11 +1097,10 @@ function M.sc(bufnr)
for _, line in ipairs(getlines(bufnr, 1, 25)) do
if
findany(line, {
- '[A-Za-z0-9]*%s:%s[A-Za-z0-9]',
'var%s<',
'classvar%s<',
'%^this.*',
- '|%w*|',
+ '|%w+|',
'%+%s%w*%s{',
'%*ar%s',
})
diff --git a/runtime/lua/vim/shared.lua b/runtime/lua/vim/shared.lua
index 9129500866..5ffd11682c 100644
--- a/runtime/lua/vim/shared.lua
+++ b/runtime/lua/vim/shared.lua
@@ -395,15 +395,14 @@ end
function vim.tbl_get(o, ...)
local keys = { ... }
if #keys == 0 then
- return
+ return nil
end
for i, k in ipairs(keys) do
- if type(o[k]) ~= 'table' and next(keys, i) then
- return nil
- end
o = o[k]
if o == nil then
- return
+ return nil
+ elseif type(o) ~= 'table' and next(keys, i) then
+ return nil
end
end
return o
diff --git a/runtime/lua/vim/treesitter.lua b/runtime/lua/vim/treesitter.lua
index 5031aca378..582922ecb6 100644
--- a/runtime/lua/vim/treesitter.lua
+++ b/runtime/lua/vim/treesitter.lua
@@ -327,12 +327,8 @@ end
---@param lang (string|nil) Language of the parser (default: buffer filetype)
function M.start(bufnr, lang)
bufnr = bufnr or a.nvim_get_current_buf()
-
local parser = M.get_parser(bufnr, lang)
-
M.highlighter.new(parser)
-
- vim.b[bufnr].ts_highlight = true
end
--- Stops treesitter highlighting for a buffer
@@ -344,8 +340,6 @@ function M.stop(bufnr)
if M.highlighter.active[bufnr] then
M.highlighter.active[bufnr]:destroy()
end
-
- vim.bo[bufnr].syntax = 'on'
end
--- Open a window that displays a textual representation of the nodes in the language tree.
diff --git a/runtime/lua/vim/treesitter/highlighter.lua b/runtime/lua/vim/treesitter/highlighter.lua
index f5e5ca1988..e99994c8a9 100644
--- a/runtime/lua/vim/treesitter/highlighter.lua
+++ b/runtime/lua/vim/treesitter/highlighter.lua
@@ -88,7 +88,11 @@ 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 = ''
+ vim.b[self.bufnr].ts_highlight = true
TSHighlighter.active[self.bufnr] = self
@@ -114,6 +118,11 @@ function TSHighlighter:destroy()
if TSHighlighter.active[self.bufnr] then
TSHighlighter.active[self.bufnr] = nil
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
+ end
end
---@private