Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lua/bento/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,14 @@ local function setup_autocmds()
local augroup =
vim.api.nvim_create_augroup("BentoRefresh", { clear = true })

vim.api.nvim_create_autocmd("BufFilePost", {
group = augroup,
callback = function()
require("bento.ui").refresh_menu()
end,
desc = "Refresh bento menu on buffer file rename",
})

vim.api.nvim_create_autocmd(
{ "BufAdd", "BufDelete", "BufWipeout", "BufEnter", "WinEnter" },
{
Expand Down
8 changes: 8 additions & 0 deletions lua/bento/ui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,14 @@ local function update_marks()
end
end

-- Sync filenames for existing marks (handles file renames)
for _, mark in ipairs(marks) do
local current_name = vim.api.nvim_buf_get_name(mark.buf_id)
if current_name ~= "" and current_name ~= mark.filename then
mark.filename = current_name
end
end

-- Add new buffers
for _, buf in pairs(vim.api.nvim_list_bufs()) do
local bufname = vim.api.nvim_buf_get_name(buf)
Expand Down