Meh I'll figure out submodules later
This commit is contained in:
parent
4ca9d44a90
commit
8cb281f436
352 changed files with 66107 additions and 0 deletions
|
|
@ -0,0 +1,36 @@
|
|||
local reload = {}
|
||||
|
||||
reload.reload_module = function(module_name, starts_with_only)
|
||||
-- Default to starts with only
|
||||
if starts_with_only == nil then
|
||||
starts_with_only = true
|
||||
end
|
||||
|
||||
-- TODO: Might need to handle cpath / compiled lua packages? Not sure.
|
||||
local matcher
|
||||
if not starts_with_only then
|
||||
matcher = function(pack)
|
||||
return string.find(pack, module_name, 1, true)
|
||||
end
|
||||
else
|
||||
local module_name_pattern = vim.pesc(module_name)
|
||||
matcher = function(pack)
|
||||
return string.find(pack, "^" .. module_name_pattern)
|
||||
end
|
||||
end
|
||||
|
||||
-- Handle impatient.nvim automatically.
|
||||
local luacache = (_G.__luacache or {}).cache
|
||||
|
||||
for pack, _ in pairs(package.loaded) do
|
||||
if matcher(pack) then
|
||||
package.loaded[pack] = nil
|
||||
|
||||
if luacache then
|
||||
luacache[pack] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return reload
|
||||
Loading…
Add table
Add a link
Reference in a new issue