From aef39b54eec81882f59aa8363f48f099fa322708 Mon Sep 17 00:00:00 2001 From: Ibrahim Mansoor Khalid Date: Thu, 21 Dec 2023 00:48:32 -0800 Subject: [PATCH] bugfix: perform cursorword_id check in lua pcall --- lua/nvim-cursorline.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/nvim-cursorline.lua b/lua/nvim-cursorline.lua index d22c3e2..60433d6 100644 --- a/lua/nvim-cursorline.lua +++ b/lua/nvim-cursorline.lua @@ -31,8 +31,8 @@ local function matchadd() return end w.cursorword = cursorword - if w.cursorword_id then - vim.call("matchdelete", w.cursorword_id) + _, ok = pcall(vim.call, "matchdelete", w.cursorword_id) + if not ok then w.cursorword_id = nil end if