From 824003d6954527bcab0ca7cd73f4fdbd0ca107bd Mon Sep 17 00:00:00 2001 From: psychhim Date: Fri, 12 Dec 2025 01:52:55 +0530 Subject: [PATCH] Update: alpha renovation --- lua/plugins/custom/alpha.lua | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/lua/plugins/custom/alpha.lua b/lua/plugins/custom/alpha.lua index b5c8a8b..b69864a 100644 --- a/lua/plugins/custom/alpha.lua +++ b/lua/plugins/custom/alpha.lua @@ -5,8 +5,7 @@ return { local alpha = require 'alpha' local dashboard = require 'alpha.themes.dashboard' - -- Load random ASCII arts - -- Keep track of last shown ASCII art + -- ASCII arts local last_ascii = nil -- load a random ASCII art local function load_random_ascii() @@ -40,16 +39,16 @@ return { local ok, splash = pcall(require, selected) return (ok and type(splash) == 'table') and splash or { 'Alpha' } end - -- Function to refresh dashboard header dynamically + -- refresh dashboard header dynamically local function refresh_header() dashboard.section.header.val = load_random_ascii() alpha.redraw() end - -- Function to handle New File logic + -- Handle New File button local function new_file_alpha() - local listed = vim.fn.getbufinfo { buflisted = 1 } -- all listed buffers - local tabs = vim.api.nvim_list_tabpages() -- all tabs + local listed = vim.fn.getbufinfo { buflisted = 1 } + local tabs = vim.api.nvim_list_tabpages() -- If exactly one listed buffer AND one tab, delete all listed buffers and open insert mode in a new buffer if #listed == 1 and #tabs == 1 then for _, buf in ipairs(listed) do @@ -61,7 +60,7 @@ return { end _G.new_file_alpha = new_file_alpha - -- Recent files button handling + -- Handle Recents button _G.open_telescope_oldfiles = function() vim.schedule(function() local keymaps = vim.api.nvim_get_keymap 'n' @@ -83,9 +82,9 @@ return { -- Setup buttons dashboard.section.buttons.val = { -- New file - dashboard.button('i', ' Create new', 'lua new_file_alpha()'), + dashboard.button('i', ' New', 'lua new_file_alpha()'), -- Recent files - dashboard.button('?', ' Recent Files', 'lua open_telescope_oldfiles()'), + dashboard.button('?', ' Recents', 'lua open_telescope_oldfiles()'), -- Open Neo-tree in current directory dashboard.button('n', ' File-tree', 'Neotree toggle float'), -- Close Alpha window or quit Neovim