summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/impatient.lua23
-rw-r--r--lua/impatient/cachepack.lua0
2 files changed, 15 insertions, 8 deletions
diff --git a/lua/impatient.lua b/lua/impatient.lua
index 4bb83fb6..ea1369fb 100644
--- a/lua/impatient.lua
+++ b/lua/impatient.lua
@@ -2,13 +2,12 @@
local vim = vim
local uv = vim.loop
-local impatient_start = uv.hrtime()
+local impatient_load_start = uv.hrtime()
local api = vim.api
local ffi = require "ffi"
local get_option, set_option = api.nvim_get_option, api.nvim_set_option
local get_runtime_file = api.nvim_get_runtime_file
-local home_dir = uv.os_homedir()
local impatient_dur
@@ -16,7 +15,7 @@ local M = {
cache = {},
profile = nil,
dirty = false,
- path = home_dir .. "/.local/share/lunarvim/cache",
+ path = nil,
log = {},
}
@@ -274,7 +273,17 @@ function M.clear_cache()
os.remove(M.path)
end
-local function setup()
+impatient_dur = uv.hrtime() - impatient_load_start
+
+function M.setup(opts)
+ opts = opts or {}
+ M.path = opts.path or vim.fn.stdpath "cache" .. "/luacache"
+
+ if opts.enable_profiling then
+ M.enable_profile()
+ end
+
+ local impatient_setup_start = uv.hrtime()
local stat = uv.fs_stat(M.path)
if stat then
log("Loading cache file %s", M.path)
@@ -344,10 +353,8 @@ local function setup()
command! LuaCacheClear lua _G.__luacache.clear_cache()
command! LuaCacheLog lua _G.__luacache.print_log()
]]
-end
-
-setup()
-impatient_dur = uv.hrtime() - impatient_start
+ impatient_dur = impatient_dur + (uv.hrtime() - impatient_setup_start)
+end
return M
diff --git a/lua/impatient/cachepack.lua b/lua/impatient/cachepack.lua
deleted file mode 100644
index e69de29b..00000000
--- a/lua/impatient/cachepack.lua
+++ /dev/null