new config old version is now on v1 branch
This commit is contained in:
71
after/plugin/startpage.lua
Normal file
71
after/plugin/startpage.lua
Normal file
@ -0,0 +1,71 @@
|
||||
local status_ok, alpha = pcall(require, "alpha")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
-- buttons
|
||||
local function button(sc, txt, keybind)
|
||||
local opts = {
|
||||
position = "center",
|
||||
shortcut = sc,
|
||||
cursor = 5,
|
||||
width = 80,
|
||||
align_shortcut = "right",
|
||||
hl_shortcut = "Keyword",
|
||||
}
|
||||
local function on_press()
|
||||
local key = vim.api.nvim_replace_termcodes(keybind .. "<Ignore>", true, false, true)
|
||||
vim.api.nvim_feedkeys(key, "t", false)
|
||||
end
|
||||
|
||||
return {
|
||||
type = "button",
|
||||
val = txt,
|
||||
on_press = on_press,
|
||||
opts = opts,
|
||||
}
|
||||
end
|
||||
|
||||
-- actual config
|
||||
local R = {}
|
||||
|
||||
R.width = vim.api.nvim_win_get_width(0)
|
||||
R.height = vim.api.nvim_win_get_height(0)
|
||||
|
||||
if R.width >= 120 then
|
||||
alpha.setup {
|
||||
layout = {
|
||||
{ type = "padding", val = math.floor(R.height / 2.5) },
|
||||
button([[ `'::. `'::::. ]], "Recent Files", "<cmd>Telescope oldfiles<CR>"),
|
||||
button([[ _________H ,%%&%, _____A_ ]], "New File", "<cmd>ene<CR>"),
|
||||
button([[ /\ _ \%&&%%&% / /\ ]], "Update Plugins", "<cmd>DepSync<CR>"),
|
||||
button([[ / \___/^\___\%&%%&& __/__/\__/ \___ ]], "", ""),
|
||||
button([[ | | [] [] |%\Y&%' /__|" '' "| /___/\ ]], "", ""),
|
||||
button([[ | | .-. | || |''|"'||'"| |' '|| ]], "", ""),
|
||||
button([[~~@._|@@_|||_@@|~||~~~ ~`""`""))""`"`""""`~~]], "", ""),
|
||||
button([[ `""") )"""` // ]], "", ""),
|
||||
}
|
||||
}
|
||||
end
|
||||
if R.width <= 119 then
|
||||
local header = {
|
||||
[[ `'::. `'::::. ]],
|
||||
[[ _________H ,%%&%, _____A_ ]],
|
||||
[[ /\ _ \%&&%%&% / /\ ]],
|
||||
[[ / \___/^\___\%&%%&& __/__/\__/ \___ ]],
|
||||
[[ | | [] [] |%\Y&%' /__|" '' "| /___/\ ]],
|
||||
[[ | | .-. | || |''|"'||'"| |' '|| ]],
|
||||
[[~~@._|@@_|||_@@|~||~~~ ~`""`""))""`"`""""`~~]],
|
||||
[[ `""") )"""` // ]],
|
||||
}
|
||||
alpha.setup {
|
||||
layout = {
|
||||
{ type = "padding", val = math.floor(R.height / 2.5) },
|
||||
{ type = "text", val = header, opts = { position = "center", hl = "AlphaHeader" } },
|
||||
{ type = "padding", val = 1 },
|
||||
button([[]], "Recent Files", "<cmd>Telescope oldfiles<CR>"),
|
||||
button([[]], "New File", "<cmd>ene<CR>"),
|
||||
button([[]], "Update Plugins", "<cmd>DepSync<CR>"),
|
||||
}
|
||||
}
|
||||
end
|
Reference in New Issue
Block a user