We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d17389c commit 4af5722Copy full SHA for 4af5722
lua/nvim-tree/utils.lua
@@ -161,6 +161,17 @@ function M.get_nodes_by_line(nodes_all, line_start)
161
end
162
163
function M.rename_loaded_buffers(old_path, new_path)
164
+ -- delete new if it exists
165
+ for _, buf in pairs(vim.api.nvim_list_bufs()) do
166
+ if vim.api.nvim_buf_is_loaded(buf) then
167
+ local buf_name = vim.api.nvim_buf_get_name(buf)
168
+ if buf_name == new_path then
169
+ vim.api.nvim_buf_delete(buf, { force = true })
170
+ end
171
172
173
+
174
+ -- rename old to new
175
for _, buf in pairs(vim.api.nvim_list_bufs()) do
176
if vim.api.nvim_buf_is_loaded(buf) then
177
local buf_name = vim.api.nvim_buf_get_name(buf)
0 commit comments