mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-21 00:25:50 +02:00
feat(defaults): new installs now default to snacks picker/explorer. Existing installs don't change.
This commit is contained in:
parent
b4c24a3fe8
commit
25d90b54a3
3 changed files with 19 additions and 7 deletions
|
@ -136,18 +136,19 @@ local defaults = {
|
|||
}
|
||||
|
||||
M.json = {
|
||||
version = 7,
|
||||
version = 8,
|
||||
loaded = false,
|
||||
path = vim.g.lazyvim_json or vim.fn.stdpath("config") .. "/lazyvim.json",
|
||||
data = {
|
||||
version = nil, ---@type string?
|
||||
version = nil, ---@type number?
|
||||
install_version = nil, ---@type number?
|
||||
news = {}, ---@type table<string, string>
|
||||
extras = {}, ---@type string[]
|
||||
},
|
||||
}
|
||||
M.json_loaded = false
|
||||
|
||||
function M.json.load()
|
||||
M.json_loaded = true
|
||||
M.json.loaded = true
|
||||
local f = io.open(M.json.path, "r")
|
||||
if f then
|
||||
local data = f:read("*a")
|
||||
|
@ -159,6 +160,8 @@ function M.json.load()
|
|||
LazyVim.json.migrate()
|
||||
end
|
||||
end
|
||||
else
|
||||
M.json.data.install_version = M.json.version
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -334,8 +337,8 @@ function M.get_defaults()
|
|||
---@type table<string, LazyVimDefault[]>
|
||||
local checks = {
|
||||
picker = {
|
||||
{ name = "fzf", extra = "editor.fzf" },
|
||||
{ name = "snacks", extra = "editor.snacks_picker" },
|
||||
{ name = "fzf", extra = "editor.fzf" },
|
||||
{ name = "telescope", extra = "editor.telescope" },
|
||||
},
|
||||
cmp = {
|
||||
|
@ -343,10 +346,17 @@ function M.get_defaults()
|
|||
{ name = "nvim-cmp", extra = "coding.nvim-cmp" },
|
||||
},
|
||||
explorer = {
|
||||
{ name = "neo-tree", extra = "editor.neo-tree" },
|
||||
{ name = "snacks", extra = "editor.snacks_explorer" },
|
||||
{ name = "neo-tree", extra = "editor.neo-tree" },
|
||||
},
|
||||
}
|
||||
|
||||
-- existing installs keep their defaults
|
||||
if (LazyVim.config.json.data.install_version or 7) < 8 then
|
||||
table.insert(checks.picker, 1, table.remove(checks.picker, 2))
|
||||
table.insert(checks.explorer, 1, table.remove(checks.explorer, 2))
|
||||
end
|
||||
|
||||
default_extras = {}
|
||||
for name, check in pairs(checks) do
|
||||
local valid = {} ---@type string[]
|
||||
|
|
|
@ -97,6 +97,8 @@ function M.migrate()
|
|||
return vim.tbl_contains(ai, name) and ("lazyvim.plugins.extras.ai." .. name) or extra
|
||||
end)
|
||||
end, json.data.extras or {})
|
||||
elseif json.data.version == 7 then
|
||||
json.data.install_version = 7
|
||||
end
|
||||
|
||||
M.save()
|
||||
|
|
|
@ -81,7 +81,7 @@ end
|
|||
function M.fix_imports()
|
||||
local defaults ---@type table<string, LazyVimDefault>
|
||||
Plugin.Spec.import = LazyVim.inject.args(Plugin.Spec.import, function(_, spec)
|
||||
if LazyVim.config.json_loaded then
|
||||
if LazyVim.config.json.loaded then
|
||||
-- extra disabled by defaults?
|
||||
defaults = defaults or LazyVim.config.get_defaults()
|
||||
local def = defaults[spec.import]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue