diff --git a/init.lua b/init.lua index 4e4f545..ecef244 100644 --- a/init.lua +++ b/init.lua @@ -403,6 +403,23 @@ local config = { -- ["~/%.config/foo/.*"] = "fooscript", -- }, -- } + local function alpha_on_bye(cmd) + local bufs = vim.fn.getbufinfo { buflisted = true } + vim.cmd(cmd) + if require("core.utils").is_available "alpha-nvim" and not bufs[2] then + require("alpha").start(true) + end + end + vim.keymap.del("n", "c") + if require("core.utils").is_available "bufdelete.nvim" then + vim.keymap.set("n", "c", function() + alpha_on_bye "Bdelete!" + end, { desc = "Close buffer" }) + else + vim.keymap.set("n", "c", function() + alpha_on_bye "bdelete!" + end, { desc = "Close buffer" }) + end end, }