echasnovski / mini.nvim

Library of 40+ independent Lua modules improving overall Neovim (version 0.8 and higher) experience with minimal effort
MIT License
4.84k stars 183 forks source link

Support for deleting the loaded buffer when delete/rename/move file in `mini.files` #633

Closed gh-liu closed 8 months ago

gh-liu commented 8 months ago

Contributing guidelines

Module(s)

mini.files

Description

Maybe it could be achieved by using autocmd, like the code below.

vim.api.nvim_create_autocmd("User", {
    pattern = "MiniFilesActionDelete",
    callback = function(args)
        local fname = args.data.from
        local bufnr = vim.fn.bufnr(fname)
        if bufnr > 0 then
            -- delete the buffer
        end
    end,
})
echasnovski commented 8 months ago

Thanks for the suggestion!

I did consider adding this as it is more or less aligned with the functionality of renaming file of an opened buffer. But eventually opted out for these reasons:

Closing as not planned.