mirror of
https://github.com/neovim/neovim.git
synced 2024-12-31 17:13:26 -07:00
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:
parent
d48cd9a0aa
commit
9248dd77ac
@ -592,6 +592,8 @@ vim.highlight.on_yank({opts}) *vim.highlight.on_yank()*
|
|||||||
- {on_macro} highlight when executing macro (default `false`)
|
- {on_macro} highlight when executing macro (default `false`)
|
||||||
- {on_visual} highlight when yanking visual selection (default `true`)
|
- {on_visual} highlight when yanking visual selection (default `true`)
|
||||||
- {event} event structure (default |v:event|)
|
- {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({bufnr}, {ns}, {hlgroup}, {start}, {finish}, {opts})
|
||||||
*vim.highlight.range()*
|
*vim.highlight.range()*
|
||||||
|
@ -61,6 +61,7 @@ local yank_timer
|
|||||||
-- - on_macro highlight when executing macro (default false)
|
-- - on_macro highlight when executing macro (default false)
|
||||||
-- - on_visual highlight when yanking visual selection (default true)
|
-- - on_visual highlight when yanking visual selection (default true)
|
||||||
-- - event event structure (default vim.v.event)
|
-- - event event structure (default vim.v.event)
|
||||||
|
-- - priority integer priority (default |vim.highlight.priorities|`.user`)
|
||||||
function M.on_yank(opts)
|
function M.on_yank(opts)
|
||||||
vim.validate({
|
vim.validate({
|
||||||
opts = {
|
opts = {
|
||||||
@ -99,14 +100,11 @@ function M.on_yank(opts)
|
|||||||
yank_timer:close()
|
yank_timer:close()
|
||||||
end
|
end
|
||||||
|
|
||||||
M.range(
|
M.range(bufnr, yank_ns, higroup, "'[", "']", {
|
||||||
bufnr,
|
regtype = event.regtype,
|
||||||
yank_ns,
|
inclusive = event.inclusive,
|
||||||
higroup,
|
priority = opts.priority or M.priorities.user,
|
||||||
"'[",
|
})
|
||||||
"']",
|
|
||||||
{ regtype = event.regtype, inclusive = event.inclusive, priority = M.priorities.user }
|
|
||||||
)
|
|
||||||
|
|
||||||
yank_timer = vim.defer_fn(function()
|
yank_timer = vim.defer_fn(function()
|
||||||
yank_timer = nil
|
yank_timer = nil
|
||||||
|
Loading…
Reference in New Issue
Block a user