Skip to content

fix(core): no autoload on require when username is lua. Closes #1981 #1982

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions lua/lazy/core/plugin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -390,12 +390,16 @@ function M.find(path, opts)
return
end
opts = opts or {}
local lua = path:find("/lua/", 1, true)
if lua then
local name = path:sub(1, lua - 1)
local slash = name:reverse():find("/", 1, true)
if slash then
name = name:sub(#name - slash + 2)
-- Find start and end of "/name_of_plugin/"
-- Example: extract lualine.nvim from the following path:
-- "/home/user/.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua"
-- "aul.enilaul/aul/mivn.enilaul/yzal/mivn/erahs/lacol./resu/emoh/"(reversed)
local reversed = path:reverse()
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 opts.fast then
return Config.spec.meta.plugins[name]
Expand Down