return function()
|
|
local if_nil = vim.F.if_nil
|
|
|
|
local default_terminal = {
|
|
type = "terminal",
|
|
command = nil,
|
|
width = 69,
|
|
height = 8,
|
|
opts = {
|
|
redraw = true,
|
|
window_config = {},
|
|
},
|
|
}
|
|
|
|
local default_header = {
|
|
type = "text",
|
|
val = {
|
|
[[ :::!~!!!!!:. ]],
|
|
[[ .xUHWH!! !!?M88WHX:. ]],
|
|
[[ .X*#M@$!! !X!M$$$$$$WWx:. ]],
|
|
[[ :!!!!!!?H! :!$!$$$$$$$$$$8X: ]],
|
|
[[ !!~ ~:~!! :~!$!#$$$$$$$$$$8X: ]],
|
|
[[ :!~::!H!< ~.U$X!?R$$$$$$$$MM! ]],
|
|
[[ ~!~!!!!~~ .:XW$$$U!!?$$$$$$RMM! ]],
|
|
[[ !:~~~ .:!M"T#$$$$WX??#MRRMMM! ]],
|
|
[[ ~?WuxiW*` `"#$$$$8!!!!??!!! ]],
|
|
[[ :X- M$$$$ `"T#$T~!8$WUXU~ ]],
|
|
[[ :%` ~#$$$m: ~!~ ?$$$$$$ ]],
|
|
[[ :!`.- ~T$$$$8xx. .xWW- ~""##*" ]],
|
|
[[..... -~~:<` ! ~?T#$$@@W@*?$$ /` ]],
|
|
[[W$@@M!!! .!~~ !! .:XUW$W!~ `"~: : ]],
|
|
[[#"~~`.:x%`!! !H: !WM$$$$Ti.: .!WUn+!` ]],
|
|
[[:::~:!!`:X~ .: ?H.!u "$$$B$$$!W:U!T$$M~ ]],
|
|
[[.~~ :X@!.-~ ?@WTWo("*$$$W$TH$! ` ]],
|
|
[[Wi.~!X$?!-~ : ?$$$B$Wu("**$RM! ]],
|
|
[[$R@i.~~ ! : ~$$$$$B$$en:`` ]],
|
|
[[?MXT@Wx.~ : ~"##*$$$$M~ ]],
|
|
},
|
|
opts = {
|
|
position = "center",
|
|
hl = "Type",
|
|
-- wrap = "overflow";
|
|
},
|
|
}
|
|
|
|
local footer = {
|
|
type = "text",
|
|
val = "",
|
|
opts = {
|
|
position = "center",
|
|
hl = "Number",
|
|
},
|
|
}
|
|
|
|
local leader = "SPC"
|
|
|
|
--- @param sc string
|
|
--- @param txt string
|
|
--- @param keybind string? optional
|
|
--- @param keybind_opts table? optional
|
|
local function button(sc, txt, keybind, keybind_opts)
|
|
local sc_ = sc:gsub("%s", ""):gsub(leader, "<leader>")
|
|
|
|
local opts = {
|
|
position = "center",
|
|
shortcut = sc,
|
|
cursor = 3,
|
|
width = 50,
|
|
align_shortcut = "right",
|
|
hl_shortcut = "Keyword",
|
|
}
|
|
if keybind then
|
|
keybind_opts = if_nil(keybind_opts, { noremap = true, silent = true, nowait = true })
|
|
opts.keymap = { "n", sc_, keybind, keybind_opts }
|
|
end
|
|
|
|
local function on_press()
|
|
local key = vim.api.nvim_replace_termcodes(keybind or sc_ .. "<Ignore>", true, false, true)
|
|
vim.api.nvim_feedkeys(key, "t", false)
|
|
end
|
|
|
|
return {
|
|
type = "button",
|
|
val = txt,
|
|
on_press = on_press,
|
|
opts = opts,
|
|
}
|
|
end
|
|
|
|
local buttons = {
|
|
type = "group",
|
|
val = {
|
|
button("e", " New file", "<cmd>ene <CR>"),
|
|
button("SPC f f", " Find file"),
|
|
button("SPC f h", " Recently opened files"),
|
|
button("SPC f r", " Frecency/MRU"),
|
|
button("SPC f g", " Find word"),
|
|
button("SPC f m", " Jump to bookmarks"),
|
|
button("SPC s l", " Open last session"),
|
|
},
|
|
opts = {
|
|
spacing = 1,
|
|
},
|
|
}
|
|
|
|
local section = {
|
|
terminal = default_terminal,
|
|
header = default_header,
|
|
buttons = buttons,
|
|
footer = footer,
|
|
}
|
|
|
|
local config = {
|
|
layout = {
|
|
{ type = "padding", val = 2 },
|
|
section.header,
|
|
{ type = "padding", val = 2 },
|
|
section.buttons,
|
|
section.footer,
|
|
},
|
|
opts = {
|
|
margin = 5,
|
|
},
|
|
}
|
|
|
|
require('alpha').setup(config)
|
|
end
|