From feb3b5afa39626eafb4e358dab57a3bbad2de3d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20=C5=A0tefka?= Date: Mon, 3 Oct 2022 04:28:29 +0200 Subject: [PATCH] Open Alpha Dashboard after closing all buffers --- init.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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, }