mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-06-27 19:24:13 +00:00
fix(core): no autoload on require when username is lua. Closes #1981
This commit is contained in:
parent
6c3bda4aca
commit
84a85f3910
1 changed files with 10 additions and 6 deletions
|
@ -390,12 +390,16 @@ function M.find(path, opts)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
local lua = path:find("/lua/", 1, true)
|
-- Find start and end of "/name_of_plugin/"
|
||||||
if lua then
|
-- Example: extract lualine.nvim from the following path:
|
||||||
local name = path:sub(1, lua - 1)
|
-- "/home/user/.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua"
|
||||||
local slash = name:reverse():find("/", 1, true)
|
-- "aul.enilaul/aul/mivn.enilaul/yzal/mivn/erahs/lacol./resu/emoh/"(reversed)
|
||||||
if slash then
|
local reversed = path:reverse()
|
||||||
name = name:sub(#name - slash + 2)
|
local rev_start, rev_end = reversed:find("/aul/", 1, true) -- find *last* "/lua/"
|
||||||
|
if rev_start then
|
||||||
|
local rev_next_slash = reversed:find("/", rev_end + 1, true)
|
||||||
|
if rev_next_slash then
|
||||||
|
local name = path:sub(#path - rev_next_slash + 2, #path - rev_end)
|
||||||
if name then
|
if name then
|
||||||
if opts.fast then
|
if opts.fast then
|
||||||
return Config.spec.meta.plugins[name]
|
return Config.spec.meta.plugins[name]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue