diff --git a/lua/plugins/custom/alpha.lua b/lua/plugins/custom/alpha.lua index d65320c..f329b62 100644 --- a/lua/plugins/custom/alpha.lua +++ b/lua/plugins/custom/alpha.lua @@ -12,40 +12,17 @@ return { -- Setup buttons dashboard.section.buttons.val = { -- New file - dashboard.button('i', ' New File', function() - local alpha_buf = vim.api.nvim_get_current_buf() - vim.api.nvim_buf_delete(alpha_buf, { force = true }) - vim.cmd 'enew' - vim.cmd 'startinsert' - end), - -- Create new tab - dashboard.button('e', ' New Tab', function() - -- Open a new tab - vim.cmd 'tabnew' - -- Open Alpha in that new tab - require('alpha').start(true) - end), + dashboard.button('i', ' New File', 'enewstartinsert'), + -- Create new tab and open Alpha + dashboard.button('e', ' New Tab', 'tabnewlua require("alpha").start(true)'), -- Open Neo-tree in current directory dashboard.button('n', ' Open Neo-tree', 'Neotree toggle float'), -- Close Alpha window or quit Neovim - dashboard.button('q', ' Exit', function() - -- Get current tab windows - local wins = vim.api.nvim_tabpage_list_wins(0) - if #wins > 1 then - -- If there are other windows in this tab, just close the Alpha window - vim.cmd 'close' - else - -- If this is the only window in the tab, check total tabs - local tab_count = #vim.api.nvim_list_tabpages() - if tab_count > 1 then - -- Close only the current tab - vim.cmd 'tabclose' - else - -- Quit Neovim if this is the last tab - vim.cmd 'qa!' - end - end - end), + dashboard.button( + 'q', + ' Exit', + 'lua (function() local wins = vim.api.nvim_tabpage_list_wins(0) if #wins > 1 then vim.cmd("close") else local tab_count = #vim.api.nvim_list_tabpages() if tab_count > 1 then vim.cmd("tabclose") else vim.cmd("qa!") end end end)()' + ), } -- Setup Alpha dashboard