Open Alpha Dashboard after closing all buffers

This commit is contained in:
Jiří Štefka 2022-10-03 04:28:29 +02:00
parent c0daeb5f24
commit feb3b5afa3

@ -403,6 +403,23 @@ local config = {
-- ["~/%.config/foo/.*"] = "fooscript", -- ["~/%.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", "<leader>c")
if require("core.utils").is_available "bufdelete.nvim" then
vim.keymap.set("n", "<leader>c", function()
alpha_on_bye "Bdelete!"
end, { desc = "Close buffer" })
else
vim.keymap.set("n", "<leader>c", function()
alpha_on_bye "bdelete!"
end, { desc = "Close buffer" })
end
end, end,
} }