Files
nvim/after/plugin/startpage.lua
Squibid 01729e2613 kitchen sink:
- add code action previews
- change indent blankline style
- more luasnip snippets
- change default mason stuff
- customize neorg more
- change notify style
- change startpage completely
- add line info to statusline
- change telescope style
- change how todo comments look
- make indentation work via treesitter
2023-10-22 18:17:21 -04:00

116 lines
4.4 KiB
Lua

local status_ok, alpha = pcall(require, "alpha")
if not status_ok then
return
end
local function button(sc, txt, cmd, kopts, opts)
opts = opts or {
position = "center",
shortcut = sc:gsub("<leader>", "LDR"),
cursor = 0,
width = 49,
align_shortcut = "right",
hl_shortcut = "AlphaShortcut",
hl = "AlphaText",
}
if cmd then
kopts = kopts or { noremap = true, silent = true, nowait = true }
opts.keymap = { "n", sc, cmd, kopts }
end
local function on_press()
local key = vim.api.nvim_replace_termcodes(cmd, true, false, true)
vim.api.nvim_feedkeys(key, "t", false)
end
return {
type = "button",
val = txt,
opts = opts,
on_press = on_press,
}
end
local header = {
'█▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▀ ▀▀▀█ █▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▀ ▀▀▀█ ',
'█ ░█████▀▀▀▀▀█████▓▄ ▀▀▀▀ ░ ░█ ░█ ░█ █ ',
'█ ▒███████ ▓███████ ▒██ ▓███ ▓███ ▓███ █ ',
'█ ▓███████ ▓███████ ▓█████████████████ █ ',
'█ ▓███████ ▓███████ ███ ██████████████ █ ',
'█ ▓███████ ▓███████ ███ ██████████████ █ ',
'█ ▓███████ ▓███████ ███ ██████████████ █ ',
'█ ▓███████ ▓███████ ███▄██████████████ █ ',
'█ ▓███████ ▓███████ ██████▀▀██████████ █ ',
'▀ ▓███████ ▓███████▄ ▄▄███████████ █ ',
'█ ▓███████ ██████████████████ █▄▄▄',
'█ ▓███████▀▀ ▀ ▀ ▀████████████████▄ ▄ █',
'█▄▄▄▄▄▄▄ ▀ █▀▀▀▀▀▀▀▀▀▀▀▀█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█',
' █ ▀ █ ',
' ▀▀▀▀▀ ',
}
local footer = {
'▄ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄',
}
alpha.setup {
layout = {
{ type = 'text', val = function()
local padding = {}
for i = 1, math.floor((vim.api.nvim_win_get_height(0) - #header - 6 - #footer) / 2), 1 do
table.insert(padding, " ")
end
return padding
end },
{ type = 'text', val = header, opts = {
position = 'center',
hl = 'AlphaHeader',
} },
{ type = 'padding', val = 1 },
{ type = 'group', val = {
button('f', '? Find files', '<cmd>Telescope find_files<CR>'),
button('r', '↺ Recent files', '<cmd>Telescope oldfiles <CR>'),
button('n', '▣ Neorg workspace', '<cmd>Telescope neorg switch_workspace<CR>'),
button('m', '≡ Menu', '<cmd>ConfigMenu<CR>'),
button('q', '✖ Quit', '<cmd>wqa<CR>'),
} },
{ type = 'text', val = footer, opts = {
position = 'center',
hl = 'AlphaFooter',
} },
},
opts = {
keymap = {
press = '<CR>',
press_queue = nil
},
setup = function()
vim.api.nvim_create_autocmd('User', {
pattern = 'AlphaReady',
desc = 'disable stuff for alpha',
callback = function()
vim.opt.laststatus = 0
vim.opt.showtabline = 0
vim.opt.more = false
vim.opt.showcmd = false
vim.opt.ruler = false
vim.opt.number = false
vim.opt.relativenumber = false
end,
})
vim.api.nvim_create_autocmd('BufUnload', {
buffer = 0,
desc = 'enable stuff after alpha closes',
callback = function()
vim.opt.laststatus = 3
vim.opt.showtabline = 2
vim.opt.more = true
vim.opt.showcmd = true
vim.opt.ruler = true
vim.opt.number = false
vim.opt.relativenumber = false
end,
})
end,
}
}