diff --git a/lua/plugins/custom/alpha.lua b/lua/plugins/custom/alpha.lua index 43d4586..89a3c88 100644 --- a/lua/plugins/custom/alpha.lua +++ b/lua/plugins/custom/alpha.lua @@ -5,12 +5,18 @@ return { local alpha = require 'alpha' local dashboard = require 'alpha.themes.dashboard' + -- Load ASCII splash local splash = require 'ascii_splash' dashboard.section.header.val = splash + -- Get Neovim starting directory + local start_dir = vim.fn.getcwd() + + -- Setup buttons dashboard.section.buttons.val = { - dashboard.button('e', ' New File', ':ene startinsert '), - dashboard.button('q', ' Quit', ':qa'), + dashboard.button('i', ' New File', ':ene startinsert '), + dashboard.button('n', ' Open Neo-tree', ':cd ' .. start_dir .. ' | Neotree toggle float'), + dashboard.button('q', ' Quit', ':qa'), } alpha.setup(dashboard.opts) diff --git a/lua/plugins/custom/filetree.lua b/lua/plugins/custom/filetree.lua index 04a6326..ea0b1a2 100644 --- a/lua/plugins/custom/filetree.lua +++ b/lua/plugins/custom/filetree.lua @@ -20,6 +20,12 @@ return { return vim.fn.fnamemodify(path, ':p') end + -- Helper function to detect Alpha dashboard buffer + local function is_alpha_buffer(buf) + local ft = vim.api.nvim_buf_get_option(buf, 'filetype') + return ft == 'alpha' + end + -- Handling deleted file or folder buffers, marking them as removed local function delete_file_mark_removed(state) local node = state.tree:get_node() @@ -128,7 +134,8 @@ return { local bufname = vim.api.nvim_buf_get_name(buf) local buftype = vim.api.nvim_buf_get_option(buf, 'buftype') local modified = vim.api.nvim_buf_get_option(buf, 'modified') - if bufname == '' and buftype == '' and not modified then + -- PATCH: Treat Alpha dashboard as empty + if (bufname == '' and buftype == '' and not modified) or is_alpha_buffer(buf) then empty_buf = buf vim.api.nvim_set_current_win(win) break diff --git a/lua/plugins/custom/telescope.lua b/lua/plugins/custom/telescope.lua index 3ca1151..0a472fd 100644 --- a/lua/plugins/custom/telescope.lua +++ b/lua/plugins/custom/telescope.lua @@ -55,6 +55,13 @@ return { -- smart_open function for Telescope to check if the current tab has an empty "No Name" buffer. If it has, it replaces the empty buffer and open a file in the same tab local actions = require 'telescope.actions' local action_state = require 'telescope.actions.state' + + -- Helper function to detect Alpha dashboard buffer + local function is_alpha_buffer(buf) + local ft = vim.api.nvim_buf_get_option(buf, 'filetype') + return ft == 'alpha' + end + local function smart_open(prompt_bufnr) local entry = action_state.get_selected_entry() if not entry then @@ -86,7 +93,9 @@ return { local name = vim.api.nvim_buf_get_name(buf) local buftype = vim.api.nvim_buf_get_option(buf, 'buftype') local modified = vim.api.nvim_buf_get_option(buf, 'modified') - if name == '' and buftype == '' and not modified then + + -- PATCH: also treat Alpha dashboard buffer as empty + if (name == '' and buftype == '' and not modified) or is_alpha_buffer(buf) then vim.api.nvim_set_current_win(win) vim.cmd('edit ' .. vim.fn.fnameescape(path)) return