From cad6355929d71ae8a34e36f635a59479c6d81b85 Mon Sep 17 00:00:00 2001 From: Abouzar Parvan Date: Tue, 16 Nov 2021 13:35:17 +0330 Subject: fix: packersync issue when you have large number of plugins (#1922) --- lua/lvim/plugin-loader.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'lua/lvim/plugin-loader.lua') diff --git a/lua/lvim/plugin-loader.lua b/lua/lvim/plugin-loader.lua index c4bd7373..ab7613c8 100644 --- a/lua/lvim/plugin-loader.lua +++ b/lua/lvim/plugin-loader.lua @@ -23,6 +23,7 @@ function plugin_loader.init(opts) compile_path = compile_path, log = { level = "warn" }, git = { clone_timeout = 300 }, + max_jobs = 50, display = { open_fn = function() return require("packer.util").float { border = "rounded" } -- cgit v1.2.3 From 24be0ef1ef36b8cc725655e920104e9676b72f25 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Sat, 27 Nov 2021 15:22:43 +0100 Subject: chore: bump core-plugins version (#1989) --- lua/lvim/plugin-loader.lua | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'lua/lvim/plugin-loader.lua') diff --git a/lua/lvim/plugin-loader.lua b/lua/lvim/plugin-loader.lua index ab7613c8..1ad4266b 100644 --- a/lua/lvim/plugin-loader.lua +++ b/lua/lvim/plugin-loader.lua @@ -1,12 +1,12 @@ local plugin_loader = {} +local in_headless = #vim.api.nvim_list_uis() == 0 + local utils = require "lvim.utils" local Log = require "lvim.core.log" -- we need to reuse this outside of init() local compile_path = get_config_dir() .. "/plugin/packer_compiled.lua" -local _, packer = pcall(require, "packer") - function plugin_loader.init(opts) opts = opts or {} @@ -18,10 +18,16 @@ function plugin_loader.init(opts) vim.cmd "packadd packer.nvim" end + local log_level = in_headless and "debug" or "warn" + if lvim.log and lvim.log.level then + log_level = lvim.log.level + end + + local _, packer = pcall(require, "packer") packer.init { package_root = package_root, compile_path = compile_path, - log = { level = "warn" }, + log = { level = log_level }, git = { clone_timeout = 300 }, max_jobs = 50, display = { @@ -59,6 +65,11 @@ end function plugin_loader.load(configurations) Log:debug "loading plugins configuration" + local packer_available, packer = pcall(require, "packer") + if not packer_available then + Log:warn "skipping loading plugins until Packer is installed" + return + end local status_ok, _ = xpcall(function() packer.startup(function(use) for _, plugins in ipairs(configurations) do -- cgit v1.2.3 From fe95dffe41455139898f2125b176a76a97331c95 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Fri, 3 Dec 2021 18:56:31 +0100 Subject: fix: no restart required when changing colorscheme (#2026) --- lua/lvim/plugin-loader.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lua/lvim/plugin-loader.lua') diff --git a/lua/lvim/plugin-loader.lua b/lua/lvim/plugin-loader.lua index 1ad4266b..5bde8b1b 100644 --- a/lua/lvim/plugin-loader.lua +++ b/lua/lvim/plugin-loader.lua @@ -83,6 +83,10 @@ function plugin_loader.load(configurations) Log:warn "problems detected while loading plugins' configurations" Log:trace(debug.traceback()) 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 function plugin_loader.get_core_plugins() -- cgit v1.2.3 From 307db8936b291b82124f05bdcfeb85be5464f21d Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Thu, 9 Dec 2021 17:08:53 +0100 Subject: feat: multiple enhancements to lvim-reload (#2054) --- lua/lvim/plugin-loader.lua | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'lua/lvim/plugin-loader.lua') diff --git a/lua/lvim/plugin-loader.lua b/lua/lvim/plugin-loader.lua index 5bde8b1b..c5220d59 100644 --- a/lua/lvim/plugin-loader.lua +++ b/lua/lvim/plugin-loader.lua @@ -28,7 +28,13 @@ function plugin_loader.init(opts) package_root = package_root, compile_path = compile_path, log = { level = log_level }, - git = { clone_timeout = 300 }, + git = { + clone_timeout = 300, + subcommands = { + -- this is more efficient than what Packer is using + fetch = "fetch --no-tags --no-recurse-submodules --update-shallow --progress", + }, + }, max_jobs = 50, display = { open_fn = function() @@ -36,6 +42,8 @@ function plugin_loader.init(opts) end, }, } + + vim.cmd [[autocmd User PackerComplete lua require('lvim.utils.hooks').run_on_packer_complete()]] end -- packer expects a space separated list @@ -104,4 +112,11 @@ function plugin_loader.sync_core_plugins() pcall_packer_command("sync", core_plugins) end +function plugin_loader.ensure_installed() + plugin_loader.cache_clear() + local all_plugins = _G.packer_plugins or plugin_loader.get_core_plugins() + Log:trace(string.format("Syncing core plugins: [%q]", table.concat(all_plugins, ", "))) + pcall_packer_command("install", all_plugins) +end + return plugin_loader -- cgit v1.2.3