fix: fixing a lot of issues
This commit is contained in:
@@ -274,55 +274,6 @@ vim.api.nvim_create_autocmd("FileType", {
|
||||
end,
|
||||
})
|
||||
|
||||
-- =============================================================================
|
||||
-- RETURN TO DASHBOARD ON LAST BUFFER CLOSE
|
||||
-- =============================================================================
|
||||
|
||||
-- When closing the last buffer, return to dashboard instead of quitting
|
||||
vim.api.nvim_create_autocmd("BufDelete", {
|
||||
callback = function(args)
|
||||
-- Count listed buffers excluding the one being deleted
|
||||
local bufs = vim.tbl_filter(function(b)
|
||||
return vim.api.nvim_buf_is_valid(b)
|
||||
and vim.bo[b].buflisted
|
||||
and vim.api.nvim_buf_get_name(b) ~= ""
|
||||
and b ~= args.buf -- Exclude the buffer being deleted
|
||||
end, vim.api.nvim_list_bufs())
|
||||
|
||||
-- If no listed buffers remain, open dashboard
|
||||
if #bufs == 0 then
|
||||
vim.schedule(function()
|
||||
-- Skip if any special windows are open
|
||||
local dominated_filetypes = {
|
||||
"NvimTree", "neo-tree", "Trouble", "qf", "help",
|
||||
"dap-repl", "dapui_watches", "dapui_stacks",
|
||||
"dapui_breakpoints", "dapui_scopes", "dapui_console",
|
||||
"snacks_dashboard", "lazygit", "terminal",
|
||||
}
|
||||
|
||||
for _, win in ipairs(vim.api.nvim_list_wins()) do
|
||||
local buf = vim.api.nvim_win_get_buf(win)
|
||||
local ft = vim.bo[buf].filetype
|
||||
if vim.tbl_contains(dominated_filetypes, ft) then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
-- Don't open if dashboard is already visible
|
||||
local current_ft = vim.bo.filetype
|
||||
if current_ft == "snacks_dashboard" then
|
||||
return
|
||||
end
|
||||
|
||||
local ok, snacks = pcall(require, "snacks")
|
||||
if ok and snacks.dashboard then
|
||||
snacks.dashboard()
|
||||
end
|
||||
end)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- =============================================================================
|
||||
-- MODERN UI: GLOBAL ROUNDED BORDERS
|
||||
-- =============================================================================
|
||||
|
||||
Reference in New Issue
Block a user