2022-02-20 01:14:43 -05:00
|
|
|
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", "<leader>")
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2022-03-19 00:19:54 -04:00
|
|
|
local default = {}
|
|
|
|
|
|
|
|
default.ascii = {
|
|
|
|
" ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣿⣶⣿⣦⣼⣆ ",
|
|
|
|
" ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ",
|
|
|
|
" ⠈⢿⣿⣟⠦ ⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄ ",
|
|
|
|
" ⣸⣿⣿⢧ ⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ",
|
|
|
|
" ⢠⣿⣿⣿⠈ ⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ",
|
|
|
|
" ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿⠄ ",
|
|
|
|
" ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ",
|
|
|
|
" ⣠⣿⠿⠛ ⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ",
|
|
|
|
" ⠙⠃ ⣼⣿⡟ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿ ⣿⣿⡇ ⠛⠻⢷⣄ ",
|
|
|
|
" ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ",
|
|
|
|
" ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ",
|
|
|
|
}
|
|
|
|
|
|
|
|
default.header = {
|
|
|
|
type = "text",
|
|
|
|
val = default.ascii,
|
|
|
|
opts = {
|
|
|
|
position = "center",
|
|
|
|
hl = "AlphaHeader",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
default.buttons = {
|
2022-02-20 01:14:43 -05:00
|
|
|
type = "group",
|
|
|
|
val = {
|
|
|
|
button("SPC f f", " Find File ", ":Telescope find_files<CR>"),
|
|
|
|
button("SPC f o", " Recent File ", ":Telescope oldfiles<CR>"),
|
|
|
|
button("SPC f w", " Find Word ", ":Telescope live_grep<CR>"),
|
|
|
|
button("SPC b m", " Bookmarks ", ":Telescope marks<CR>"),
|
|
|
|
button("SPC t h", " Themes ", ":Telescope themes<CR>"),
|
|
|
|
button("SPC e s", " Settings", ":e $MYVIMRC | :cd %:p:h <CR>"),
|
|
|
|
},
|
|
|
|
opts = {
|
|
|
|
spacing = 1,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2022-03-19 00:19:54 -04:00
|
|
|
default.section = {
|
|
|
|
header = default.header,
|
|
|
|
buttons = default.buttons,
|
2022-02-20 01:14:43 -05:00
|
|
|
}
|
|
|
|
|
2022-03-19 00:19:54 -04:00
|
|
|
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 = 5 },
|
|
|
|
default.section.header,
|
|
|
|
{ type = "padding", val = 2 },
|
|
|
|
default.section.buttons,
|
|
|
|
},
|
|
|
|
opts = {},
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
return M
|