From f5454fb86087f9f7372f3be7af797d9dc0297d6e Mon Sep 17 00:00:00 2001 From: LostNeophyte Date: Tue, 29 Nov 2022 08:50:24 +0100 Subject: feat(alpha): allow configuring highlight groups (#3532) * fix(alpha): make highlights overridable Co-authored-by: CPea <42694704+cpea2506@users.noreply.github.com> * feat: make opts overridable * refactor: add default autostart to opts * feat: default_button_opts * Apply suggestions from code review Co-authored-by: kylo252 <59826753+kylo252@users.noreply.github.com> Co-authored-by: CPea <42694704+cpea2506@users.noreply.github.com> Co-authored-by: kylo252 <59826753+kylo252@users.noreply.github.com> --- lua/lvim/core/alpha/dashboard.lua | 40 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 23 deletions(-) (limited to 'lua/lvim/core/alpha') diff --git a/lua/lvim/core/alpha/dashboard.lua b/lua/lvim/core/alpha/dashboard.lua index a1ba7c5a..26c7e053 100644 --- a/lua/lvim/core/alpha/dashboard.lua +++ b/lua/lvim/core/alpha/dashboard.lua @@ -114,31 +114,25 @@ function M.get_sections() hl = "Number", }, } - local buttons = {} - local status_ok, dashboard = pcall(require, "alpha.themes.dashboard") - if status_ok then - local function button(sc, txt, keybind, keybind_opts) - local b = dashboard.button(sc, txt, keybind, keybind_opts) - b.opts.hl_shortcut = "Include" - return b - end - buttons = { - val = { - button("f", lvim.icons.ui.FindFile .. " Find File", "Telescope find_files"), - button("n", lvim.icons.ui.NewFile .. " New File", "ene!"), - button("p", lvim.icons.ui.Project .. " Projects ", "Telescope projects"), - button("r", lvim.icons.ui.History .. " Recent files", ":Telescope oldfiles "), - button("t", lvim.icons.ui.FindText .. " Find Text", "Telescope live_grep"), - button( - "c", - lvim.icons.ui.Gear .. " Configuration", - "edit " .. require("lvim.config"):get_user_config_path() .. " " - ), + local buttons = { + opts = { + hl_shortcut = "Include", + spacing = 1, + }, + entries = { + { "f", lvim.icons.ui.FindFile .. " Find File", "Telescope find_files" }, + { "n", lvim.icons.ui.NewFile .. " New File", "ene!" }, + { "p", lvim.icons.ui.Project .. " Projects ", "Telescope projects" }, + { "r", lvim.icons.ui.History .. " Recent files", ":Telescope oldfiles " }, + { "t", lvim.icons.ui.FindText .. " Find Text", "Telescope live_grep" }, + { + "c", + lvim.icons.ui.Gear .. " Configuration", + "edit " .. require("lvim.config"):get_user_config_path() .. " ", }, - } - end - + }, + } return { header = header, buttons = buttons, -- cgit v1.2.3