mirror of https://github.com/folke/lazy.nvim.git
style: cleanup
This commit is contained in:
parent
a197f751f9
commit
a87b6e1005
|
@ -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
|
||||
},
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue