diff options
-rw-r--r-- | lua/lvim/core/cmp.lua | 37 | ||||
-rw-r--r-- | lua/lvim/core/lualine/init.lua | 6 | ||||
-rw-r--r-- | lua/lvim/core/theme.lua | 18 | ||||
-rw-r--r-- | lua/lvim/plugin-loader.lua | 4 | ||||
-rw-r--r-- | utils/installer/config_win.example.lua | 2 | ||||
-rwxr-xr-x | utils/installer/install.sh | 1 |
6 files changed, 46 insertions, 22 deletions
diff --git a/lua/lvim/core/cmp.lua b/lua/lvim/core/cmp.lua index 5163b877..42ba7003 100644 --- a/lua/lvim/core/cmp.lua +++ b/lua/lvim/core/cmp.lua @@ -334,6 +334,23 @@ M.config = function() fallback() -- if not exited early, always fallback end), }, + cmdline = { + enable = true, + options = { + { + type = ":", + sources = { + { name = "path" }, + }, + }, + { + type = { "/", "?" }, + sources = { + { name = "buffer" }, + }, + }, + }, + }, } end @@ -341,18 +358,14 @@ function M.setup() local cmp = require "cmp" cmp.setup(lvim.builtin.cmp) - cmp.setup.cmdline(":", { - mapping = cmp.mapping.preset.cmdline(), - sources = { - { name = "path" }, - }, - }) - cmp.setup.cmdline({ "/", "?" }, { - mapping = cmp.mapping.preset.cmdline(), - sources = { - { name = "buffer" }, - }, - }) + if lvim.builtin.cmp.cmdline.enable then + for _, option in ipairs(lvim.builtin.cmp.cmdline.options) do + cmp.setup.cmdline(option.type, { + mapping = cmp.mapping.preset.cmdline(), + sources = option.sources, + }) + end + end end return M diff --git a/lua/lvim/core/lualine/init.lua b/lua/lvim/core/lualine/init.lua index cd6237bf..f7cacb35 100644 --- a/lua/lvim/core/lualine/init.lua +++ b/lua/lvim/core/lualine/init.lua @@ -34,6 +34,12 @@ M.config = function() end M.setup = function() + 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, lualine = pcall(require, "lualine") if not status_ok then return diff --git a/lua/lvim/core/theme.lua b/lua/lvim/core/theme.lua index 394963a0..0f960d3d 100644 --- a/lua/lvim/core/theme.lua +++ b/lua/lvim/core/theme.lua @@ -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 - require("lvim.core.lualine").setup() + vim.g.colors_name = lvim.colorscheme + vim.cmd("colorscheme " .. lvim.colorscheme) + require("lvim.core.lualine").setup() require("lvim.core.lir").icon_setup() end diff --git a/lua/lvim/plugin-loader.lua b/lua/lvim/plugin-loader.lua index d09c722b..392d3ceb 100644 --- a/lua/lvim/plugin-loader.lua +++ b/lua/lvim/plugin-loader.lua @@ -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()) diff --git a/utils/installer/config_win.example.lua b/utils/installer/config_win.example.lua index bc83aab7..40cc34e8 100644 --- a/utils/installer/config_win.example.lua +++ b/utils/installer/config_win.example.lua @@ -107,7 +107,7 @@ lvim.builtin.treesitter.highlight.enable = true -- -- make sure server will always be installed even if the server is in skipped_servers list -- lvim.lsp.installer.setup.ensure_installed = { --- "sumeko_lua", +-- "sumneko_lua", -- "jsonls", -- } -- -- change UI setting of `LspInstallInfo` diff --git a/utils/installer/install.sh b/utils/installer/install.sh index cafd92ad..aefc52c2 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -445,7 +445,6 @@ function setup_lvim() { echo "Preparing Packer setup" "$INSTALL_PREFIX/bin/lvim" --headless \ - -c "lua require('lvim.core.log'):set_level([[$LUNARVIM_LOG_LEVEL]])" \ -c 'autocmd User PackerComplete quitall' \ -c 'PackerSync' |