From 28fb0f37defd67372c053b63671407d73858e427 Mon Sep 17 00:00:00 2001 From: MeanderingProgrammer Date: Tue, 4 Nov 2025 13:54:59 -0800 Subject: [PATCH] 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. --- lua/lazy/core/loader.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazy/core/loader.lua b/lua/lazy/core/loader.lua index 1501efd..e4e5235 100644 --- a/lua/lazy/core/loader.lua +++ b/lua/lazy/core/loader.lua @@ -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