config: move lazy cache to state/nvim/lazy/cache

This commit is contained in:
Folke Lemaitre 2022-12-19 13:55:00 +01:00
parent 7eb60345d6
commit 8a0da3b27e
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 2 additions and 1 deletions

View File

@ -9,7 +9,7 @@ M.VERSION = "1"
---@class LazyCacheConfig ---@class LazyCacheConfig
M.config = { M.config = {
enabled = true, enabled = true,
path = vim.fn.stdpath("state") .. "/lazy.state", path = vim.fn.stdpath("state") .. "/lazy/cache",
-- Once one of the following events triggers, caching will be disabled. -- Once one of the following events triggers, caching will be disabled.
-- To cache all modules, set this to `{}`, but that is not recommended. -- To cache all modules, set this to `{}`, but that is not recommended.
-- The default is to disable on: -- The default is to disable on:
@ -219,6 +219,7 @@ function M.eq(h1, h2)
end end
function M.save_cache() function M.save_cache()
vim.fn.mkdir(vim.fn.fnamemodify(M.config.path, ":p:h"), "p")
local f = assert(uv.fs_open(M.config.path, "w", 438)) local f = assert(uv.fs_open(M.config.path, "w", 438))
uv.fs_write(f, M.VERSION) uv.fs_write(f, M.VERSION)
uv.fs_write(f, "\0") uv.fs_write(f, "\0")