From 698cdf72b2e3a9a7f4fd80920629f7d23d8a59c5 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sat, 1 Jun 2024 16:26:38 +1000 Subject: [PATCH] refactor(#2787): replace deprecated --- lua/nvim-tree/utils.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lua/nvim-tree/utils.lua b/lua/nvim-tree/utils.lua index bdd8c76c..30f34edc 100644 --- a/lua/nvim-tree/utils.lua +++ b/lua/nvim-tree/utils.lua @@ -226,7 +226,14 @@ function M.rename_loaded_buffers(old_path, new_path) vim.api.nvim_buf_set_name(buf, new_path .. buf_name:sub(#old_path + 1)) -- to avoid the 'overwrite existing file' error message on write for -- normal files - if vim.api.nvim_buf_get_option(buf, "buftype") == "" then + local buftype + if vim.fn.has "nvim-0.10" == 1 then + buftype = vim.api.nvim_get_option_value("buftype", { buf = buf }) + else + buftype = vim.api.nvim_buf_get_option(buf, "buftype") ---@diagnostic disable-line: deprecated + end + + if buftype == "" then vim.api.nvim_buf_call(buf, function() vim.cmd "silent! write!" vim.cmd "edit"