From b30c0312ea1c5bed6b28e72d930059622b0525f8 Mon Sep 17 00:00:00 2001 From: Thomas Vandal Date: Tue, 26 May 2026 09:27:06 -0400 Subject: [PATCH] fix(autocmds): replace `vim.hl.on_yank` with `vim.hl.hl_op` for `nvim-0.13` and above (#7171) ## Description 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. --- lua/lazyvim/config/autocmds.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/config/autocmds.lua b/lua/lazyvim/config/autocmds.lua index a0b058a6..9e16022b 100644 --- a/lua/lazyvim/config/autocmds.lua +++ b/lua/lazyvim/config/autocmds.lua @@ -18,7 +18,11 @@ vim.api.nvim_create_autocmd({ "FocusGained", "TermClose", "TermLeave" }, { vim.api.nvim_create_autocmd("TextYankPost", { group = augroup("highlight_yank"), callback = function() - (vim.hl or vim.highlight).on_yank() + if vim.fn.has("nvim-0.13") then + vim.hl.hl_op() + else + (vim.hl or vim.highlight).on_yank() + end end, })