mirror of
https://github.com/LunarVim/LunarVim.git
synced 2024-09-20 18:45:08 +02:00
feat: warn user when setting un-installed colorscheme (#2982)
This commit is contained in:
parent
5699a5e557
commit
8763ed2878
2 changed files with 14 additions and 8 deletions
|
@ -1,3 +1,5 @@
|
|||
local Log = require "lvim.core.log"
|
||||
|
||||
local M = {}
|
||||
|
||||
M.config = function()
|
||||
|
@ -85,20 +87,26 @@ end
|
|||
M.setup = function()
|
||||
-- avoid running in headless mode since it's harder to detect failures
|
||||
if #vim.api.nvim_list_uis() == 0 then
|
||||
local Log = require "lvim.core.log"
|
||||
Log:debug "headless mode detected, skipping running setup for lualine"
|
||||
return
|
||||
end
|
||||
|
||||
local status_ok, theme = pcall(require, "tokyonight")
|
||||
if not status_ok then
|
||||
return
|
||||
if status_ok and theme then
|
||||
theme.setup(lvim.builtin.theme.options)
|
||||
end
|
||||
|
||||
theme.setup(lvim.builtin.theme.options)
|
||||
-- ref: https://github.com/neovim/neovim/issues/18201#issuecomment-1104754564
|
||||
local colors = vim.api.nvim_get_runtime_file(("colors/%s.*"):format(lvim.colorscheme), false)
|
||||
if #colors == 0 then
|
||||
Log:warn(string.format("Could not find '%s' colorscheme", lvim.colorscheme))
|
||||
lvim.colorscheme = "tokyonight"
|
||||
end
|
||||
|
||||
vim.g.colors_name = lvim.colorscheme
|
||||
vim.cmd("colorscheme " .. lvim.colorscheme)
|
||||
|
||||
require("lvim.core.lualine").setup()
|
||||
|
||||
require("lvim.core.lir").icon_setup()
|
||||
end
|
||||
|
||||
|
|
|
@ -106,10 +106,8 @@ function plugin_loader.load(configurations)
|
|||
end
|
||||
end
|
||||
end)
|
||||
-- colorscheme must get called after plugins are loaded or it will break new installs.
|
||||
vim.g.colors_name = lvim.colorscheme
|
||||
vim.cmd("colorscheme " .. lvim.colorscheme)
|
||||
end, debug.traceback)
|
||||
|
||||
if not status_ok then
|
||||
Log:warn "problems detected while loading plugins' configurations"
|
||||
Log:trace(debug.traceback())
|
||||
|
|
Loading…
Reference in a new issue