Small changes and adding alpha lua
This commit is contained in:
57
lua/taken/plugins/alpha.lua
Normal file
57
lua/taken/plugins/alpha.lua
Normal file
@@ -0,0 +1,57 @@
|
||||
return {
|
||||
"goolord/alpha-nvim",
|
||||
event = "VimEnter",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
opts = function()
|
||||
local dashboard = require("alpha.themes.dashboard")
|
||||
local logo = [[
|
||||
██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z
|
||||
██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z
|
||||
██║ ███████║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z
|
||||
██║ ██╔══██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z
|
||||
███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║
|
||||
╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
|
||||
]]
|
||||
dashboard.section.header.val = vim.split(logo, "\n")
|
||||
dashboard.section.buttons.val = {
|
||||
dashboard.button("f", " " .. "Find files", ":Telescope find_files <CR>"),
|
||||
dashboard.button("p", " " .. "Select project", ":Telescope project <CR>"),
|
||||
dashboard.button("n", " " .. "Neorg", ":Neorg workspace main <CR>"),
|
||||
dashboard.button("l", " " .. "Lazy sync", ":Lazy sync <CR>"),
|
||||
}
|
||||
for _, button in ipairs(dashboard.section.buttons.val) do
|
||||
button.opts.hl = "AlphaButtons"
|
||||
button.opts.hl_shortcut = "AlphaShortcut"
|
||||
end
|
||||
dashboard.section.header.opts.hl = "AlphaHeader"
|
||||
dashboard.section.buttons.opts.hl = "AlphaButtons"
|
||||
dashboard.section.footer.opts.hl = "AlphaFooter"
|
||||
dashboard.opts.layout[1].val = 4
|
||||
return dashboard
|
||||
end,
|
||||
config = function(_, dashboard)
|
||||
if vim.o.filetype == "lazy" then
|
||||
vim.cmd.close()
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "AlphaReady",
|
||||
callback = function()
|
||||
require("lazy").show()
|
||||
end,
|
||||
})
|
||||
end
|
||||
require("alpha").setup(dashboard.opts)
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "LazyVimStarted",
|
||||
callback = function()
|
||||
local stats = require("lazy").stats()
|
||||
local version = vim.version().major .. "." .. vim.version().minor .. "." .. vim.version().patch
|
||||
local plugins_count = stats.count
|
||||
local ms = math.floor(stats.startuptime + 0.5)
|
||||
local time = vim.fn.strftime("%H:%M:%S")
|
||||
local date = vim.fn.strftime("%d.%m.%Y")
|
||||
dashboard.section.footer.val = " " .. version .. " " .. plugins_count .. " plugins in " .. ms .. "ms " .. date .. " " .. time
|
||||
pcall(vim.cmd.AlphaRedraw)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
Reference in New Issue
Block a user