diff --git a/dots/.nvim-environments/primary/config/lua/plugins/configs/alpha.lua b/dots/.nvim-environments/primary/config/lua/plugins/configs/alpha.lua index a0fb37d3..2611e5a0 100644 --- a/dots/.nvim-environments/primary/config/lua/plugins/configs/alpha.lua +++ b/dots/.nvim-environments/primary/config/lua/plugins/configs/alpha.lua @@ -1,77 +1,80 @@ -local alpha = require('alpha') -local startify = require('alpha.themes.startify') -local dashboard = require('alpha.themes.dashboard') +local alpha = require("alpha") +local startify = require("alpha.themes.startify") +local dashboard = require("alpha.themes.dashboard") -- Set header local header = { - type = 'text', + type = "text", val = { - ' ', - ' ', - ' ', - ' ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣿⣶⣿⣦⣼⣆ ', - ' ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ', - ' ⠈⢿⣿⣟⠦ ⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄ ', - ' ⣸⣿⣿⢧ ⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ', - ' ⢠⣿⣿⣿⠈ ⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ', - ' ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿⠄ ', - ' ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ', - ' ⣠⣿⠿⠛ ⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ', - ' ⠙⠃ ⣼⣿⡟ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿ ⣿⣿⡇ ⠛⠻⢷⣄ ', - ' ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ', - ' ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ', - ' ', - }, - opts = { - position = 'center', - hl = 'Function', + " ", + " ", + " ", + " ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣿⣶⣿⣦⣼⣆ ", + " ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ", + " ⠈⢿⣿⣟⠦ ⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄ ", + " ⣸⣿⣿⢧ ⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ", + " ⢠⣿⣿⣿⠈ ⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ", + " ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿⠄ ", + " ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ", + " ⣠⣿⠿⠛ ⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ", + " ⠙⠃ ⣼⣿⡟ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿ ⣿⣿⡇ ⠛⠻⢷⣄ ", + " ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ", + " ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ", + " ", }, + opts = { position = "center", hl = "Delimiter" }, } --- Subheader, plugin count -local get_plugin_info = function() - if require("lazy.status").has_updates() then - return "Plugin updates available, check :Lazy" - else - return "All plugins up to date" - end -end - -local plugin_info = { - type = 'text', +local plugins_loaded = { + type = "text", val = { - get_plugin_info() + (function() + local lazy_stats = require("lazy").stats() + local plugin_count = lazy_stats.count + local loaded_plugins = lazy_stats.loaded + return "" .. loaded_plugins .. "/" .. plugin_count .. " plugins  loaded!" + end)(), }, - opts = { - hl = 'Comment', - position = 'center', + opts = { hl = "@conditional", position = "center" }, +} +local plugin_info = { + type = "text", + val = { + (function() + if require("lazy.status").has_updates() then + return "Plugin updates available, check :Lazy" + else + return "All plugins up to date" + end + end)(), }, + opts = { hl = "@decorator", position = "center" }, } -- Menu local button = function(sc, txt, keybind) - local sc_ = sc:gsub('%s', ''):gsub('SPC', '') + local sc_ = sc:gsub("%s", ""):gsub("SPC", "") local opts = { - position = 'center', + position = "center", text = txt, shortcut = sc, cursor = 4, width = 30, - align_shortcut = 'right', - hl_shortcut = 'Number', - hl = 'Function', + align_shortcut = "right", + hl_shortcut = "Number", + hl = "Function", } if keybind then - opts.keymap = { 'n', sc_, keybind, { noremap = true, silent = true } } + opts.keymap = { "n", sc_, keybind, { noremap = true, silent = true } } end return { - type = 'button', + type = "button", val = txt, on_press = function() local key = vim.api.nvim_replace_termcodes(sc_, true, false, true) - vim.api.nvim_feedkeys(key, 'normal', false) + vim.api.nvim_feedkeys(key, "normal", false) end, opts = opts, } @@ -79,53 +82,48 @@ end -- Set menu local buttons = { - type = 'group', + type = "group", val = { - button('e', ' New File', ':ene startinsert '), - button('f', ' Find File', ':Telescope find_files'), - button('r', ' Recent', ':Telescope oldfiles'), - button('s', ' Settings', ':e ~/.config/nvim/'), - button('u', ' Update Plugins', ':Lazy sync'), - button('q', ' Quit', ':qa'), - }, - opts = { - spacing = 0, + button("e", " New File", ":ene startinsert "), + button("f", " Find File", ":Telescope find_files"), + button("r", " Recent", ":Telescope oldfiles"), + button("s", " Settings", ":e ~/.config/nvim/"), + button("u", " Update Plugins", ":Lazy sync"), + button("q", " Quit", ":qa"), }, + opts = { spacing = 0 }, } -- Footer 2, fortune local fortune = { - type = 'text', - val = require('alpha.fortune')(), - opts = { - position = 'center', - hl = 'Comment', - }, + type = "text", + val = require("alpha.fortune")(), + opts = { position = "center", hl = "Comment" }, } -local padding = function() - return { type = 'padding', val = 4 } +local padding = function(pad_amount) + return { type = "padding", val = pad_amount } end local opts = { layout = { - padding(), + padding(12), header, - padding(), + padding(4), plugin_info, - padding(), + padding(1), + plugins_loaded, + padding(4), buttons, - padding(), + padding(4), fortune, }, - opts = { - margin = 5, - }, + opts = { margin = 5 }, } -- Send config to alpha alpha.setup(opts) -vim.api.nvim_create_autocmd('FileType', { - pattern = 'alpha', +vim.api.nvim_create_autocmd("FileType", { + pattern = "alpha", callback = function() vim.opt_local.cursorline = false end,