feat: allow a custom path for lazyvim.json
. Fixes #3856
This commit is contained in:
@ -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()
|
||||
|
@ -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()
|
||||
|
Reference in New Issue
Block a user