From 223ab2a679e086f1690744edf9f6a2b851c37593 Mon Sep 17 00:00:00 2001 From: ChristianChiarulli Date: Thu, 22 Sep 2022 09:18:18 -0400 Subject: fix: pcall for dashboard --- lua/lvim/core/alpha/dashboard.lua | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'lua') diff --git a/lua/lvim/core/alpha/dashboard.lua b/lua/lvim/core/alpha/dashboard.lua index 51338554..ac80c03a 100644 --- a/lua/lvim/core/alpha/dashboard.lua +++ b/lua/lvim/core/alpha/dashboard.lua @@ -102,26 +102,27 @@ function M.get_sections() hl = "Number", }, } + local buttons = {} - local dashboard = require "alpha.themes.dashboard" - - local function button(sc, txt, keybind, keybind_opts) - local b = dashboard.button(sc, txt, keybind, keybind_opts) - b.opts.hl_shortcut = "Macro" - return b + 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 = "Macro" + return b + end + buttons = { + val = { + button("f", " Find File", "Telescope find_files"), + button("n", " New File", "ene!"), + button("p", " Projects ", "Telescope projects"), + button("r", " Recent files", ":Telescope oldfiles "), + button("t", " Find Text", "Telescope live_grep"), + button("c", " Configuration", "edit " .. require("lvim.config"):get_user_config_path() .. " "), + }, + } end - local buttons = { - val = { - button("f", " Find File", "Telescope find_files"), - button("n", " New File", "ene!"), - button("p", " Projects ", "Telescope projects"), - button("r", " Recent files", ":Telescope oldfiles "), - button("t", " Find Text", "Telescope live_grep"), - button("c", " Configuration", "edit " .. require("lvim.config"):get_user_config_path() .. " "), - }, - } - return { header = header, buttons = buttons, -- cgit v1.2.3