feat(lua): add hl priority opts on yank (#23509)

feat(lua): add hl priority opts on_yank

Signed-off-by: marcoSven <me@marcosven.com>
This commit is contained in:
marcoSven 2023-05-06 21:53:36 +02:00 committed by GitHub
parent d48cd9a0aa
commit 9248dd77ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -592,6 +592,8 @@ vim.highlight.on_yank({opts}) *vim.highlight.on_yank()*
- {on_macro} highlight when executing macro (default `false`)
- {on_visual} highlight when yanking visual selection (default `true`)
- {event} event structure (default |v:event|)
- {priority} priority of highlight (default |vim.highlight.priorities|`.user`)
vim.highlight.range({bufnr}, {ns}, {hlgroup}, {start}, {finish}, {opts})
*vim.highlight.range()*

View File

@ -61,6 +61,7 @@ local yank_timer
-- - on_macro highlight when executing macro (default false)
-- - on_visual highlight when yanking visual selection (default true)
-- - event event structure (default vim.v.event)
-- - priority integer priority (default |vim.highlight.priorities|`.user`)
function M.on_yank(opts)
vim.validate({
opts = {
@ -99,14 +100,11 @@ function M.on_yank(opts)
yank_timer:close()
end
M.range(
bufnr,
yank_ns,
higroup,
"'[",
"']",
{ regtype = event.regtype, inclusive = event.inclusive, priority = M.priorities.user }
)
M.range(bufnr, yank_ns, higroup, "'[", "']", {
regtype = event.regtype,
inclusive = event.inclusive,
priority = opts.priority or M.priorities.user,
})
yank_timer = vim.defer_fn(function()
yank_timer = nil