feat(loader): handle hyphens in file names when deactivating

## Description

When deactivating plugins `vim.g.loaded_` variables are cleared based on
a common pattern plugins use to use avoid multiple initializing. The
current logic handles most cases, except when a lua file has a hyphen in
which case it is unlikely to clear the correct variable.
This commit is contained in:
MeanderingProgrammer 2025-11-04 13:54:59 -08:00
commit 28fb0f37de
No known key found for this signature in database

View file

@ -238,7 +238,7 @@ function M.deactivate(plugin)
-- clear vim.g.loaded_ for plugins
Util.ls(plugin.dir .. "/plugin", function(_, name, type)
if type == "file" then
vim.g["loaded_" .. name:gsub("%..*", "")] = nil
vim.g["loaded_" .. name:gsub("%..*", ""):gsub("-", "_")] = nil
end
end)
-- set as not loaded