Skip to content

Commit 459f733

Browse files
committed
refactor(#2787): replace deprecated
1 parent 8e2f81f commit 459f733

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lua/nvim-tree/actions/finders/search-node.lua

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,15 @@ function M.fn()
6969

7070
-- temporarily set &path
7171
local bufnr = vim.api.nvim_get_current_buf()
72-
local path_existed, path_opt = pcall(vim.api.nvim_buf_get_option, bufnr, "path")
73-
vim.api.nvim_buf_set_option(bufnr, "path", core.get_cwd() .. "/**")
72+
73+
local path_existed, path_opt
74+
if vim.fn.has "nvim-0.10" == 1 then
75+
path_existed, path_opt = pcall(vim.api.nvim_get_option_value, "path", { buf = bufnr })
76+
vim.api.nvim_set_option_value("path", core.get_cwd() .. "/**", { buf = bufnr })
77+
else
78+
path_existed, path_opt = pcall(vim.api.nvim_buf_get_option, bufnr, "path") ---@diagnostic disable-line: deprecated
79+
vim.api.nvim_buf_set_option(bufnr, "path", core.get_cwd() .. "/**") ---@diagnostic disable-line: deprecated
80+
end
7481

7582
vim.ui.input({ prompt = "Search: ", completion = "file_in_path" }, function(input_path)
7683
if not input_path or input_path == "" then

0 commit comments

Comments
 (0)