Skip to content

Commit b6bb459

Browse files
committed
fix(loader): fix enabled field
1 parent 1cf9c7c commit b6bb459

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

lua/plug/loader.lua

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ function M.parser(plugSpec)
6161
plugSpec.enabled = true
6262
elseif type(plugSpec.enabled) == 'function' then
6363
plugSpec.enabled = plugSpec.enabled()
64+
-- make sure enabled() return boolean
65+
if type(plugSpec.enabled) ~= 'boolean' then
66+
plugSpec.enabled = false
67+
end
68+
if not plugSpec.enabled then
69+
return plugSpec
70+
end
6471
elseif type(plugSpec.enabled) ~= 'boolean' or plugSpec.enabled == false then
6572
plugSpec.enabled = false
6673
return plugSpec
@@ -127,7 +134,8 @@ function M.load(plugSpec)
127134
plugSpec.config()
128135
end
129136
if vim.fn.has('vim_starting') ~= 1 then
130-
local plugin_directory_files = vim.fn.globpath(plugSpec.rtp, 'plugin/*.{lua,vim}', false, true)
137+
local plugin_directory_files =
138+
vim.fn.globpath(plugSpec.rtp, 'plugin/*.{lua,vim}', false, true)
131139
for _, f in ipairs(plugin_directory_files) do
132140
vim.cmd.source(f)
133141
end

0 commit comments

Comments
 (0)