feat: allow a custom path for lazyvim.json. Fixes #3856

This commit is contained in:
Folke Lemaitre
2024-06-29 21:19:13 +02:00
parent ee44b21898
commit 131187c092
2 changed files with 3 additions and 4 deletions

View File

@ -136,6 +136,7 @@ local defaults = {
M.json = {
version = 6,
path = vim.g.lazyvim_json or vim.fn.stdpath("config") .. "/lazyvim.json",
data = {
version = nil, ---@type string?
news = {}, ---@type table<string, string>
@ -144,8 +145,7 @@ M.json = {
}
function M.json.load()
local path = vim.fn.stdpath("config") .. "/lazyvim.json"
local f = io.open(path, "r")
local f = io.open(M.json.path, "r")
if f then
local data = f:read("*a")
f:close()

View File

@ -45,8 +45,7 @@ end
function M.save()
LazyVim.config.json.data.version = LazyVim.config.json.version
local path = vim.fn.stdpath("config") .. "/lazyvim.json"
local f = io.open(path, "w")
local f = io.open(LazyVim.config.json.path, "w")
if f then
f:write(LazyVim.json.encode(LazyVim.config.json.data))
f:close()