perf: reset packpath to only include the lazy package. Improved my startup time by 2ms

This commit is contained in:
Folke Lemaitre 2022-12-01 11:23:34 +01:00
parent 5134e797f3
commit 4653119625
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
3 changed files with 17 additions and 6 deletions

View file

@ -40,8 +40,8 @@ function M.try(fn, msg)
end
if info.what == "Lua" and not info.source:find("lazy.nvim") then
local source = info.source:sub(2)
if source:find(Config.options.packpath, 1, true) == 1 then
source = source:sub(#Config.options.packpath + 1):gsub("^/opt/", ""):gsub("^/start/", "")
if source:find(Config.paths.opt, 1, true) == 1 then
source = source:sub(#Config.paths.opt + 1)
end
source = vim.fn.fnamemodify(source, ":p:~:.")
local line = " - " .. source .. ":" .. info.currentline