mirror of https://github.com/folke/lazy.nvim.git
feat(ui): better detection of plugins/config files that loaded a plugin
This commit is contained in:
parent
e22e8e4506
commit
723274efee
|
@ -191,21 +191,22 @@ function M:reason(reason, opts)
|
||||||
---@type string?
|
---@type string?
|
||||||
local source = reason.source
|
local source = reason.source
|
||||||
if source then
|
if source then
|
||||||
local name = source:match("/([^/]-)/lua")
|
source = vim.loop.fs_realpath(source) or source
|
||||||
for _, other in pairs(Config.plugins) do
|
for _, other in pairs(Config.plugins) do
|
||||||
if name and other.name == name then
|
if source:find(vim.loop.fs_realpath(other.dir), 1, true) then
|
||||||
reason.plugin = other.name
|
reason.plugin = other.name
|
||||||
reason.source = nil
|
reason.source = nil
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if reason.source then
|
if reason.source then
|
||||||
source = vim.loop.fs_realpath(source) or source
|
local config = vim.loop.fs_realpath(vim.fn.stdpath("config"))
|
||||||
local config = vim.loop.fs_realpath(vim.fn.stdpath("config") .. "/lua")
|
if source == config .. "/init.lua" then
|
||||||
if source:find(config, 1, true) == 1 then
|
reason.source = "init.lua"
|
||||||
reason.source = source:sub(#config + 2):gsub("/", "."):gsub("%.lua$", "")
|
else
|
||||||
if reason.source == "lua" then
|
config = config .. "/lua"
|
||||||
reason.source = "init.lua"
|
if source:find(config, 1, true) == 1 then
|
||||||
|
reason.source = source:sub(#config + 2):gsub("/", "."):gsub("%.lua$", "")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue