fix: add function close_existing_buffer_by_name back

This commit is contained in:
2025-02-09 00:14:45 +01:00
parent ebc0791542
commit 0f044a625e

View File

@@ -54,6 +54,16 @@ local function read_file(path)
return data
end
-- Added function to close existing buffers matching a name pattern.
local function close_existing_buffer_by_name(name_pattern)
for _, buf in ipairs(vim.api.nvim_list_bufs()) do
local buf_name = vim.api.nvim_buf_get_name(buf)
if buf_name:match(name_pattern) then
vim.api.nvim_buf_delete(buf, {force = true})
end
end
end
------------------------------------------------------------------------------
-- PROMPT CONSTRUCTION
------------------------------------------------------------------------------