mirror of
https://github.com/hyzendust/KickestEnd.nvim.git
synced 2026-02-15 03:41:14 +01:00
Fix: Alpha buttons unpressable/clickable using enter or mouse.
This commit is contained in:
@@ -12,40 +12,17 @@ return {
|
|||||||
-- Setup buttons
|
-- Setup buttons
|
||||||
dashboard.section.buttons.val = {
|
dashboard.section.buttons.val = {
|
||||||
-- New file
|
-- New file
|
||||||
dashboard.button('i', ' New File', function()
|
dashboard.button('i', ' New File', '<Cmd>enew<CR><Cmd>startinsert<CR>'),
|
||||||
local alpha_buf = vim.api.nvim_get_current_buf()
|
-- Create new tab and open Alpha
|
||||||
vim.api.nvim_buf_delete(alpha_buf, { force = true })
|
dashboard.button('<leader>e', ' New Tab', '<Cmd>tabnew<CR><Cmd>lua require("alpha").start(true)<CR>'),
|
||||||
vim.cmd 'enew'
|
|
||||||
vim.cmd 'startinsert'
|
|
||||||
end),
|
|
||||||
-- Create new tab
|
|
||||||
dashboard.button('<leader>e', ' New Tab', function()
|
|
||||||
-- Open a new tab
|
|
||||||
vim.cmd 'tabnew'
|
|
||||||
-- Open Alpha in that new tab
|
|
||||||
require('alpha').start(true)
|
|
||||||
end),
|
|
||||||
-- Open Neo-tree in current directory
|
-- Open Neo-tree in current directory
|
||||||
dashboard.button('<leader>n', ' Open Neo-tree', '<Cmd>Neotree toggle float<CR>'),
|
dashboard.button('<leader>n', ' Open Neo-tree', '<Cmd>Neotree toggle float<CR>'),
|
||||||
-- Close Alpha window or quit Neovim
|
-- Close Alpha window or quit Neovim
|
||||||
dashboard.button('<leader>q', ' Exit', function()
|
dashboard.button(
|
||||||
-- Get current tab windows
|
'<leader>q',
|
||||||
local wins = vim.api.nvim_tabpage_list_wins(0)
|
' Exit',
|
||||||
if #wins > 1 then
|
'<Cmd>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)()<CR>'
|
||||||
-- 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),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Setup Alpha dashboard
|
-- Setup Alpha dashboard
|
||||||
|
|||||||
Reference in New Issue
Block a user