Skip to content

Commit 698cdf7

Browse files
committed
refactor(#2787): replace deprecated
1 parent 7f047dd commit 698cdf7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lua/nvim-tree/utils.lua

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,14 @@ function M.rename_loaded_buffers(old_path, new_path)
226226
vim.api.nvim_buf_set_name(buf, new_path .. buf_name:sub(#old_path + 1))
227227
-- to avoid the 'overwrite existing file' error message on write for
228228
-- normal files
229-
if vim.api.nvim_buf_get_option(buf, "buftype") == "" then
229+
local buftype
230+
if vim.fn.has "nvim-0.10" == 1 then
231+
buftype = vim.api.nvim_get_option_value("buftype", { buf = buf })
232+
else
233+
buftype = vim.api.nvim_buf_get_option(buf, "buftype") ---@diagnostic disable-line: deprecated
234+
end
235+
236+
if buftype == "" then
230237
vim.api.nvim_buf_call(buf, function()
231238
vim.cmd "silent! write!"
232239
vim.cmd "edit"

0 commit comments

Comments
 (0)