mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-22 04:21:08 +00:00
fix(autocmds): replace vim.hl.on_yank with vim.hl.hl_op for nvim-0.13 and above (#7171)
## Description <!-- Describe the big picture of your changes to communicate to the maintainers why we should accept this pull request. --> A recent PR (https://github.com/neovim/neovim/pull/39777) replaced `vim.hl.on_yank` with a more generic `vim.hl.hl_op` and deprecated the former. This PR simply checks for `nvim-0.13` support and uses the new interface if available. This removes a deprecation warning and will avoid an error when `on_yank` gets deprecated in the nvim 0.14 release. Thanks! ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines.
This commit is contained in:
parent
c429ebb628
commit
b30c0312ea
1 changed files with 5 additions and 1 deletions
|
|
@ -18,7 +18,11 @@ vim.api.nvim_create_autocmd({ "FocusGained", "TermClose", "TermLeave" }, {
|
||||||
vim.api.nvim_create_autocmd("TextYankPost", {
|
vim.api.nvim_create_autocmd("TextYankPost", {
|
||||||
group = augroup("highlight_yank"),
|
group = augroup("highlight_yank"),
|
||||||
callback = function()
|
callback = function()
|
||||||
|
if vim.fn.has("nvim-0.13") then
|
||||||
|
vim.hl.hl_op()
|
||||||
|
else
|
||||||
(vim.hl or vim.highlight).on_yank()
|
(vim.hl or vim.highlight).on_yank()
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue