diff options
author | ChristianChiarulli <[email protected]> | 2022-09-22 09:18:18 -0400 |
---|---|---|
committer | ChristianChiarulli <[email protected]> | 2022-09-22 09:18:18 -0400 |
commit | 223ab2a679e086f1690744edf9f6a2b851c37593 (patch) | |
tree | f0f0b8247775bba6b6a65ebed8442219035011c3 | |
parent | 6511e997c5b8d3a357abd87f3a644e3fad2ffcfd (diff) |
fix: pcall for dashboard
-rw-r--r-- | lua/lvim/core/alpha/dashboard.lua | 35 |
1 files changed, 18 insertions, 17 deletions
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", "<CMD>Telescope find_files<CR>"), + button("n", " New File", "<CMD>ene!<CR>"), + button("p", " Projects ", "<CMD>Telescope projects<CR>"), + button("r", " Recent files", ":Telescope oldfiles <CR>"), + button("t", " Find Text", "<CMD>Telescope live_grep<CR>"), + button("c", " Configuration", "<CMD>edit " .. require("lvim.config"):get_user_config_path() .. " <CR>"), + }, + } end - local buttons = { - val = { - button("f", " Find File", "<CMD>Telescope find_files<CR>"), - button("n", " New File", "<CMD>ene!<CR>"), - button("p", " Projects ", "<CMD>Telescope projects<CR>"), - button("r", " Recent files", ":Telescope oldfiles <CR>"), - button("t", " Find Text", "<CMD>Telescope live_grep<CR>"), - button("c", " Configuration", "<CMD>edit " .. require("lvim.config"):get_user_config_path() .. " <CR>"), - }, - } - return { header = header, buttons = buttons, |