2022-06-12 15:21:04 -05:00
|
|
|
local alpha = require('alpha')
|
2022-06-12 16:50:04 -05:00
|
|
|
local startify = require('alpha.themes.startify')
|
2022-06-12 15:21:04 -05:00
|
|
|
local dashboard = require('alpha.themes.dashboard')
|
|
|
|
|
|
|
|
-- Set header
|
2022-06-12 16:50:04 -05:00
|
|
|
local header = {
|
|
|
|
type = 'text',
|
|
|
|
val = {
|
|
|
|
' ',
|
|
|
|
' ',
|
|
|
|
' ',
|
|
|
|
' ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣿⣶⣿⣦⣼⣆ ',
|
|
|
|
' ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ',
|
|
|
|
' ⠈⢿⣿⣟⠦ ⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄ ',
|
|
|
|
' ⣸⣿⣿⢧ ⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ',
|
|
|
|
' ⢠⣿⣿⣿⠈ ⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ',
|
|
|
|
' ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿⠄ ',
|
|
|
|
' ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ',
|
|
|
|
' ⣠⣿⠿⠛ ⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ',
|
|
|
|
' ⠙⠃ ⣼⣿⡟ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿ ⣿⣿⡇ ⠛⠻⢷⣄ ',
|
|
|
|
' ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ',
|
|
|
|
' ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ',
|
|
|
|
' ',
|
|
|
|
},
|
|
|
|
opts = {
|
|
|
|
position = 'center',
|
|
|
|
hl = 'Function',
|
|
|
|
},
|
2022-06-12 15:21:04 -05:00
|
|
|
}
|
|
|
|
|
2022-06-12 16:50:04 -05:00
|
|
|
-- Subheader, plugin count
|
|
|
|
local get_plugins = function()
|
|
|
|
local num_plugins_loaded = #vim.fn.globpath(vim.fn.stdpath('data') .. '/site/pack/packer/start', '*', 0, 1)
|
|
|
|
local num_plugins_total = #vim.tbl_keys(packer_plugins)
|
|
|
|
if num_plugins_total <= 1 then
|
|
|
|
return num_plugins_loaded .. ' / ' .. num_plugins_total .. ' plugin loaded'
|
|
|
|
else
|
|
|
|
return num_plugins_loaded .. ' / ' .. num_plugins_total .. ' plugins loaded'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
local plugin_count = {
|
|
|
|
type = 'text',
|
|
|
|
val = {
|
|
|
|
get_plugins(),
|
|
|
|
},
|
|
|
|
opts = {
|
|
|
|
hl = 'Comment',
|
|
|
|
position = 'center',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
-- Menu
|
|
|
|
local button = function(sc, txt, keybind)
|
|
|
|
local sc_ = sc:gsub('%s', ''):gsub('SPC', '<leader>')
|
|
|
|
|
|
|
|
local opts = {
|
|
|
|
position = 'center',
|
|
|
|
text = txt,
|
|
|
|
shortcut = sc,
|
|
|
|
cursor = 4,
|
|
|
|
width = 30,
|
|
|
|
align_shortcut = 'right',
|
|
|
|
hl_shortcut = 'Number',
|
|
|
|
hl = 'Function',
|
|
|
|
}
|
|
|
|
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-06-12 15:21:04 -05:00
|
|
|
-- Set menu
|
2022-06-12 16:50:04 -05:00
|
|
|
local buttons = {
|
|
|
|
type = 'group',
|
|
|
|
val = {
|
|
|
|
button('e', ' New File', ':ene <BAR> startinsert <CR>'),
|
|
|
|
button('f', ' Find File', ':Telescope find_files<CR>'),
|
|
|
|
button('r', ' Recent', ':Telescope oldfiles<CR>'),
|
2022-07-05 00:12:28 -05:00
|
|
|
button('s', ' Settings', ':e ~/.config/nvim/<CR>'),
|
2022-06-12 16:50:04 -05:00
|
|
|
button('u', ' Update Plugins', ':PackerSync<CR>'),
|
|
|
|
button('q', ' Quit', ':qa<CR>'),
|
|
|
|
},
|
|
|
|
opts = {
|
|
|
|
spacing = 0,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
-- Footer 2, fortune
|
|
|
|
local fortune = {
|
|
|
|
type = 'text',
|
|
|
|
val = require('alpha.fortune')(),
|
|
|
|
opts = {
|
|
|
|
position = 'center',
|
|
|
|
hl = 'Comment',
|
|
|
|
},
|
2022-06-12 15:21:04 -05:00
|
|
|
}
|
|
|
|
|
2022-06-12 16:50:04 -05:00
|
|
|
local padding = function()
|
|
|
|
return { type = 'padding', val = 4 }
|
|
|
|
end
|
|
|
|
local opts = {
|
|
|
|
layout = {
|
|
|
|
padding(),
|
|
|
|
header,
|
|
|
|
padding(),
|
|
|
|
plugin_count,
|
|
|
|
padding(),
|
|
|
|
buttons,
|
|
|
|
padding(),
|
|
|
|
fortune,
|
|
|
|
},
|
|
|
|
opts = {
|
|
|
|
margin = 5,
|
|
|
|
},
|
|
|
|
}
|
2022-06-12 15:21:04 -05:00
|
|
|
-- Send config to alpha
|
2022-06-12 16:50:04 -05:00
|
|
|
alpha.setup(opts)
|
2022-06-12 15:21:04 -05:00
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd('FileType', {
|
|
|
|
pattern = 'alpha',
|
|
|
|
callback = function()
|
|
|
|
vim.opt_local.cursorline = false
|
|
|
|
end,
|
|
|
|
})
|