_
This commit is contained in:
61
nvim/lua/my/dashboard.lua
Executable file
61
nvim/lua/my/dashboard.lua
Executable file
@@ -0,0 +1,61 @@
|
||||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
local alpha = require('alpha')
|
||||
local dashboard = require('alpha.themes.dashboard')
|
||||
|
||||
dashboard.section.header.val =
|
||||
{[[ ⠄⠄⣼⡟⣿⠏⢀⣿⣇⣿⣏⣿⣿⣿⣿⣿⣿⣿⢸⡇⣿⣿⣿⣟⣿⣿⣿⣿ ]],
|
||||
[[ ⡆⣸⡟⣼⣯⠏⣾⣿⢸⣿⢸⣿⣿⣿⣿⣿⣿⡟⠸⠁⢹⡿⣿⣿⢻⣿⣿⣿ ]],
|
||||
[[ ⡇⡟⣸⢟⣫⡅⣶⢆⡶⡆⣿⣿⣿⣿⣿⢿⣛⠃⠰⠆⠈⠁⠈⠙⠈⠻⣿⢹ ]],
|
||||
[[ ⣧⣱⡷⣱⠿⠟⠛⠼⣇⠇⣿⣿⣿⣿⣿⣿⠃⣰⣿⣿⡆⠄⠄⠄⠄⠄⠉⠈ ]],
|
||||
[[ ⡏⡟⢑⠃⡠⠂⠄⠄⠈⣾⢻⣿⣿⡿⡹⡳⠋⠉⠁⠉⠙⠄⢀⠄⠄⠄⠄⠄ ]],
|
||||
[[ ⡇⠁⢈⢰⡇⠄⠄⡙⠂⣿⣿⣿⣿⣱⣿⡗⠄⠄⠄⢀⡀⠄⠈⢰⠄⠄⠄⠐ ]],
|
||||
[[ ⠄⠄⠘⣿⣧⠴⣄⣡⢄⣿⣿⣿⣷⣿⣿⡇⢀⠄⠤⠈⠁⣠⣠⣸⢠⠄⠄⠄ ]],
|
||||
[[ ⢀⠄⠄⣿⣿⣷⣬⣵⣿⣿⣿⣿⣿⣿⣿⣷⣟⢷⡶⢗⡰⣿⣿⠇⠘⠄⠄⠄ ]],
|
||||
[[ ⣿⠄⠄⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣾⣿⣿⡟⢀⠃⠄⢸⡄ ]],
|
||||
[[ ⣿⠄⠄⠘⢿⣿⣿⣿⣿⣿⣿⢛⣿⣿⣿⣿⣿⣿⣿⣿⣿⣟⢄⡆⠄⢀⣪⡆ ]],
|
||||
[[ ⡟⠄⠄⠄⠄⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢿⣟⣻⣩⣾⣃⣴⣿⣿⡇ ]]}
|
||||
|
||||
-- Set menu
|
||||
dashboard.section.buttons.val = {dashboard.button("n", " New file", ":enew <CR>"),
|
||||
dashboard.button("s", " Settings", ":e $MYVIMRC <CR>"),
|
||||
dashboard.button("q", " Quit NVIM", ":qa<CR>")}
|
||||
|
||||
-- Set footer
|
||||
local function footer()
|
||||
local datetime = os.date("%H:%M")
|
||||
local version = vim.version()
|
||||
local nvim_version_info = "v" .. version.major .. "." .. version.minor .. "." .. version.patch
|
||||
|
||||
return string.format("%s %s", datetime, nvim_version_info)
|
||||
end
|
||||
|
||||
dashboard.section.footer.val = footer()
|
||||
|
||||
-- set layout
|
||||
dashboard.config.layout = {{
|
||||
type = "padding",
|
||||
val = 1
|
||||
}, dashboard.section.header, {
|
||||
type = "padding",
|
||||
val = 2
|
||||
}, dashboard.section.buttons, {
|
||||
type = "padding",
|
||||
val = 1
|
||||
}, dashboard.section.footer}
|
||||
|
||||
-- autostart
|
||||
vim.api.nvim_create_autocmd("VimEnter", {
|
||||
callback = function()
|
||||
if vim.fn.argc() == 0 then
|
||||
require("alpha").start()
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
dashboard.config.opts.noautocmd = true
|
||||
alpha.setup(dashboard.config)
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user