aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/highlight.lua
diff options
context:
space:
mode:
authoraltermo <107814000+altermo@users.noreply.github.com>2024-06-07 17:33:40 +0200
committerGitHub <noreply@github.com>2024-06-07 08:33:40 -0700
commitf3632e14e3a75114415050ab01c2d04a06036009 (patch)
treeb3a7067d7cbde9305b01324384a0aac76e6a56ae /runtime/lua/vim/highlight.lua
parent2ce4a4d91e4abee0aab8b98c47eea9fbd4849ba6 (diff)
downloadrneovim-f3632e14e3a75114415050ab01c2d04a06036009.tar.gz
rneovim-f3632e14e3a75114415050ab01c2d04a06036009.tar.bz2
rneovim-f3632e14e3a75114415050ab01c2d04a06036009.zip
feat: get/set namespace properties #28728
ref https://github.com/neovim/neovim/pull/28432 ref https://github.com/neovim/neovim/issues/28469
Diffstat (limited to 'runtime/lua/vim/highlight.lua')
-rw-r--r--runtime/lua/vim/highlight.lua9
1 files changed, 2 insertions, 7 deletions
diff --git a/runtime/lua/vim/highlight.lua b/runtime/lua/vim/highlight.lua
index e972ffaa8c..233bc50237 100644
--- a/runtime/lua/vim/highlight.lua
+++ b/runtime/lua/vim/highlight.lua
@@ -31,8 +31,6 @@ M.priorities = {
--- Indicates priority of highlight
--- (default: `vim.highlight.priorities.user`)
--- @field priority? integer
----
---- @field package _scoped? boolean
--- Apply highlight group to range of text.
---
@@ -47,7 +45,6 @@ function M.range(bufnr, ns, higroup, start, finish, opts)
local regtype = opts.regtype or 'v'
local inclusive = opts.inclusive or false
local priority = opts.priority or M.priorities.user
- local scoped = opts._scoped or false
local v_maxcol = vim.v.maxcol
@@ -114,7 +111,6 @@ function M.range(bufnr, ns, higroup, start, finish, opts)
end_col = end_col,
priority = priority,
strict = false,
- scoped = scoped,
})
end
end
@@ -178,19 +174,18 @@ function M.on_yank(opts)
yank_cancel()
end
- vim.api.nvim__win_add_ns(winid, yank_ns)
+ vim.api.nvim__ns_set(yank_ns, { wins = { winid } })
M.range(bufnr, yank_ns, higroup, "'[", "']", {
regtype = event.regtype,
inclusive = event.inclusive,
priority = opts.priority or M.priorities.user,
- _scoped = true,
})
yank_cancel = function()
yank_timer = nil
yank_cancel = nil
pcall(vim.api.nvim_buf_clear_namespace, bufnr, yank_ns, 0, -1)
- pcall(vim.api.nvim__win_del_ns, winid, yank_ns)
+ pcall(vim.api.nvim__ns_set, { wins = {} })
end
yank_timer = vim.defer_fn(yank_cancel, timeout)