From c3cbbcd2c46ef35eb63e0589f0040f0e27ca04e1 Mon Sep 17 00:00:00 2001 From: xVermillionx Date: Mon, 4 Mar 2024 00:57:32 +0100 Subject: [PATCH 1/2] fix: wrap searchcount in pcall to avoid error --- lua/nvim-tree.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/nvim-tree.lua b/lua/nvim-tree.lua index 07d06140363..de1131b8707 100644 --- a/lua/nvim-tree.lua +++ b/lua/nvim-tree.lua @@ -105,8 +105,8 @@ function M.open_on_directory() end function M.place_cursor_on_node() - local search = vim.fn.searchcount() - if search and search.exact_match == 1 then + local ok, search = pcall(vim.fn.searchcount()) + if ok and search and search.exact_match == 1 then return end From fcc043a57e3e9220594beaa2f7fcba04ceb90ca3 Mon Sep 17 00:00:00 2001 From: DB <76707179+xVermillionx@users.noreply.github.com> Date: Mon, 4 Mar 2024 02:18:59 +0100 Subject: [PATCH 2/2] fix: searchcount in pcall --- lua/nvim-tree.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/nvim-tree.lua b/lua/nvim-tree.lua index de1131b8707..999a13b1abf 100644 --- a/lua/nvim-tree.lua +++ b/lua/nvim-tree.lua @@ -105,7 +105,7 @@ function M.open_on_directory() end function M.place_cursor_on_node() - local ok, search = pcall(vim.fn.searchcount()) + local ok, search = pcall(vim.fn.searchcount) if ok and search and search.exact_match == 1 then return end