diff --git a/lua/lazy/core/config.lua b/lua/lazy/core/config.lua index 6fa55a1..275d0fa 100644 --- a/lua/lazy/core/config.lua +++ b/lua/lazy/core/config.lua @@ -10,14 +10,22 @@ M.defaults = { version = nil, -- version = "*", -- enable this to try installing the latest stable versions of plugins }, + packpath = vim.fn.stdpath("data") .. "/site/pack/lazy", -- package path where new plugins will be installed + lockfile = vim.fn.stdpath("config") .. "/lazy-lock.json", -- lockfile generated after running update. + install_missing = true, -- install missing plugins on startup. This doesn't increase startup time. + git = { + -- defaults for `Lazy log` + -- log = { "-10" }, -- last 10 commits + log = { "--since=1 days ago" }, -- commits from the last 3 days + }, + -- Any plugin spec that contains one of the patterns will use your + -- local repo in the projects folder instead of fetchig it from github + -- Mostly useful for plugin developers. dev = { path = vim.fn.expand("~/projects"), -- the path where you store your projects ---@type string[] patterns = {}, -- For example {"folke"} }, - packpath = vim.fn.stdpath("data") .. "/site/pack/lazy", - lockfile = vim.fn.stdpath("config") .. "/lazy-lock.json", - view = { ui = { -- The border to use for the UI window. Accepts same border values as |nvim_open_win()|. border = "none", @@ -32,11 +40,6 @@ M.defaults = { ft = " ", task = "✔ ", }, - install_missing = true, - git = { - -- defaults for `Lazy log` - log = { "-10" }, -- last 10 commits - -- log = { "--since=3 days ago" }, -- commits from the last 3 days throttle = 20, -- how frequently should the ui process render events }, } diff --git a/lua/lazy/core/module.lua b/lua/lazy/core/module.lua index 6d59254..674eb57 100644 --- a/lua/lazy/core/module.lua +++ b/lua/lazy/core/module.lua @@ -111,9 +111,7 @@ function M.autosave() local hash = M.hash(cache_path) -- abort when the file was changed in the meantime if hash == nil or M.eq(cache_hash, hash) then - vim.fn.system("echo start >> foo.txt") M.save_cache() - vim.fn.system("echo stop >> foo.txt") end end end, diff --git a/lua/lazy/init.lua b/lua/lazy/init.lua index 49a978c..955fd55 100644 --- a/lua/lazy/init.lua +++ b/lua/lazy/init.lua @@ -25,7 +25,7 @@ function M.setup(opts) for _, plugin in pairs(Config.plugins) do if not plugin._.installed then vim.cmd("do User LazyInstallPre") - require("lazy.manage").install({ wait = true, show = Config.options.interactive }) + require("lazy.manage").install({ wait = true }) break end end diff --git a/lua/lazy/view/commands.lua b/lua/lazy/view/commands.lua index 52e4626..43afaa3 100644 --- a/lua/lazy/view/commands.lua +++ b/lua/lazy/view/commands.lua @@ -18,17 +18,17 @@ end M.commands = { clean = function(plugins) - Manage.clean({ clear = true, interactive = true, mode = "clean", plugins = plugins }) + Manage.clean({ clear = true, mode = "clean", plugins = plugins }) end, clear = function() Manage.clear() View.show() end, install = function() - Manage.install({ clear = true, interactive = true, mode = "install" }) + Manage.install({ clear = true, mode = "install" }) end, log = function(plugins) - Manage.log({ clear = true, interactive = true, mode = "log", plugins = plugins }) + Manage.log({ clear = true, mode = "log", plugins = plugins }) end, show = function() View.show() @@ -40,18 +40,18 @@ M.commands = { View.show("profile") end, sync = function() - Manage.clean({ interactive = true, clear = true, wait = true, mode = "sync" }) + Manage.clean({ clear = true, wait = true, mode = "sync" }) Manage.update({ interactive = true }) Manage.install({ interactive = true }) end, update = function(plugins) - Manage.update({ clear = true, interactive = true, mode = "update", plugins = plugins }) + Manage.update({ clear = true, mode = "update", plugins = plugins }) end, check = function(plugins) - Manage.check({ clear = true, interactive = true, mode = "check", plugins = plugins }) + Manage.check({ clear = true, mode = "check", plugins = plugins }) end, restore = function(plugins) - Manage.update({ clear = true, interactive = true, lockfile = true, mode = "restore", plugins = plugins }) + Manage.update({ clear = true, lockfile = true, mode = "restore", plugins = plugins }) end, } diff --git a/tests/core/plugin_spec.lua b/tests/core/plugin_spec.lua index acf3424..950a597 100644 --- a/tests/core/plugin_spec.lua +++ b/tests/core/plugin_spec.lua @@ -30,7 +30,7 @@ end) describe("plugin spec opt", function() it("handles dependencies", function() - Config.options.opt = false + Config.options.defaults.opt = false local tests = { { "foo/bar", dependencies = { "foo/dep1", "foo/dep2" } }, { "foo/bar", dependencies = { { "foo/dep1" }, "foo/dep2" } }, @@ -52,7 +52,7 @@ describe("plugin spec opt", function() end) it("handles opt from dep", function() - Config.options.opt = false + Config.options.defaults.opt = false local spec = Plugin.Spec.new({ "foo/dep1", { "foo/bar", dependencies = { "foo/dep1", "foo/dep2" } } }) Config.plugins = spec.plugins Plugin.update_state() @@ -65,8 +65,25 @@ describe("plugin spec opt", function() assert(spec.plugins.dep1.opt == false) end) + it("handles defaults opt", function() + do + Config.options.defaults.opt = true + local spec = Plugin.Spec.new({ "foo/bar" }) + Config.plugins = spec.plugins + Plugin.update_state() + assert(spec.plugins.bar.opt == true) + end + do + Config.options.defaults.opt = false + local spec = Plugin.Spec.new({ "foo/bar" }) + Config.plugins = spec.plugins + Plugin.update_state() + assert(spec.plugins.bar.opt == false) + end + end) + it("handles opt from dep", function() - Config.options.opt = false + Config.options.defaults.opt = false local spec = Plugin.Spec.new({ "foo/bar", module = "foo" }) Config.plugins = spec.plugins Plugin.update_state()