local present, alpha = pcall(require, "alpha") if not present then return end local function button(sc, txt, keybind) local sc_ = sc:gsub("%s", ""):gsub("SPC", "") local opts = { position = "center", text = txt, shortcut = sc, cursor = 5, width = 36, align_shortcut = "right", hl = "AlphaButtons", } if keybind then opts.keymap = { "n", sc_, keybind, { noremap = true, silent = true } } end return { 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) end, opts = opts, } end local default = {} default.ascii = { " ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣿⣶⣿⣦⣼⣆ ", " ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ", " ⠈⢿⣿⣟⠦ ⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄ ", " ⣸⣿⣿⢧ ⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ", " ⢠⣿⣿⣿⠈ ⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ", " ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿⠄ ", " ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ", " ⣠⣿⠿⠛ ⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ", " ⠙⠃ ⣼⣿⡟ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿ ⣿⣿⡇ ⠛⠻⢷⣄ ", " ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ", " ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ", } default.header = { type = "text", val = default.ascii, opts = { position = "center", hl = "AlphaHeader", }, } default.buttons = { type = "group", val = { button("SPC f f", " Find File ", ":Telescope find_files"), button("SPC f o", " Recent File ", ":Telescope oldfiles"), button("SPC f w", " Find Word ", ":Telescope live_grep"), button("SPC b m", " Bookmarks ", ":Telescope marks"), button("SPC t h", " Themes ", ":Telescope themes"), button("SPC e s", " Settings", ":e $MYVIMRC | :cd %:p:h "), }, opts = { spacing = 1, }, } local M = {} M.setup = function(override_flag) if override_flag then default = require("core.utils").tbl_override_req("alpha", default) end alpha.setup { layout = { { type = "padding", val = 4 }, default.header, { type = "padding", val = 2 }, default.buttons, }, opts = {}, } end return M