2022-02-20 06:14:43 +00: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-04-27 15:42:28 +00:00
|
|
|
local options = {}
|
2022-03-19 04:19:54 +00:00
|
|
|
|
2022-04-27 15:42:28 +00:00
|
|
|
local ascii = {
|
2022-03-19 04:19:54 +00:00
|
|
|
" ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣿⣶⣿⣦⣼⣆ ",
|
|
|
|
" ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ",
|
|
|
|
" ⠈⢿⣿⣟⠦ ⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄ ",
|
|
|
|
" ⣸⣿⣿⢧ ⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ",
|
|
|
|
" ⢠⣿⣿⣿⠈ ⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ",
|
|
|
|
" ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿⠄ ",
|
|
|
|
" ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ",
|
|
|
|
" ⣠⣿⠿⠛ ⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ",
|
|
|
|
" ⠙⠃ ⣼⣿⡟ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿ ⣿⣿⡇ ⠛⠻⢷⣄ ",
|
|
|
|
" ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ",
|
|
|
|
" ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ",
|
|
|
|
}
|
|
|
|
|
2022-04-27 15:42:28 +00:00
|
|
|
options.header = {
|
2022-03-19 04:19:54 +00:00
|
|
|
type = "text",
|
2022-04-27 15:42:28 +00:00
|
|
|
val = ascii,
|
2022-03-19 04:19:54 +00:00
|
|
|
opts = {
|
|
|
|
position = "center",
|
|
|
|
hl = "AlphaHeader",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2022-04-27 15:42:28 +00:00
|
|
|
options.buttons = {
|
2022-02-20 06:14:43 +00: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-05-10 13:43:48 +00:00
|
|
|
options = nvchad.load_override(options, "goolord/alpha-nvim")
|
2022-03-20 02:00:30 +00:00
|
|
|
|
2022-05-10 12:11:26 +00:00
|
|
|
-- dynamic header padding
|
|
|
|
local fn = vim.fn
|
|
|
|
local marginTopPercent = 0.3
|
|
|
|
local headerPadding = fn.max { 2, fn.floor(fn.winheight(0) * marginTopPercent) }
|
|
|
|
|
2022-04-27 15:42:28 +00:00
|
|
|
alpha.setup {
|
|
|
|
layout = {
|
2022-05-10 12:11:26 +00:00
|
|
|
{ type = "padding", val = headerPadding },
|
2022-04-27 15:42:28 +00:00
|
|
|
options.header,
|
|
|
|
{ type = "padding", val = 2 },
|
|
|
|
options.buttons,
|
|
|
|
},
|
|
|
|
opts = {},
|
|
|
|
}
|