diff --git a/bundle/nvim-plug/lua/plug/config.lua b/bundle/nvim-plug/lua/plug/config.lua index ed7d76234d34..31c8f3317d57 100644 --- a/bundle/nvim-plug/lua/plug/config.lua +++ b/bundle/nvim-plug/lua/plug/config.lua @@ -21,6 +21,7 @@ function M.setup(opt) M.http_proxy = opt.http_proxy M.https_proxy = opt.https_proxy M.clone_depth = opt.clone_depth or M.clone_depth + M.raw_plugin_dir = opt.raw_plugin_dir or M.raw_plugin_dir end return M diff --git a/bundle/nvim-plug/lua/plug/loader.lua b/bundle/nvim-plug/lua/plug/loader.lua index b3af9913a5f5..e02d641393e5 100644 --- a/bundle/nvim-plug/lua/plug/loader.lua +++ b/bundle/nvim-plug/lua/plug/loader.lua @@ -28,20 +28,24 @@ local add_raw_rtp = false --- @field type string "git", "raw" or "none" --- @field script_type string "git", "raw" or "none" +--- @param plugSpec PluginSpec +--- @return boolean local function is_local_plugin(plugSpec) if plugSpec.is_local or vim.fn.isdirectory(plugSpec[1]) == 1 then plugSpec.is_local = true return true + else + return false end end - +--- @param plugSpec PluginSpec +--- @return string local function check_name(plugSpec) if not plugSpec[1] and not plugSpec.url then - return false + return '' end local s = vim.split(plugSpec[1] or plugSpec.url, '/') - plugSpec.name = s[#s] - return true + return s[#s] end function M.parser(plugSpec) @@ -52,7 +56,9 @@ function M.parser(plugSpec) elseif type(plugSpec.enabled) ~= 'boolean' or plugSpec.enabled == false then plugSpec.enabled = false return plugSpec - elseif not check_name(plugSpec) then + end + plugSpec.name = check_name(plugSpec) + if #plugSpec.name == 0 then plugSpec.enabled = false return plugSpec end @@ -65,9 +71,9 @@ function M.parser(plugSpec) plugSpec.enabled = false return plugSpec else - plugSpec.path = config.raw_plugin_dir .. '/' .. plugSpec.script_type .. plugSpec.name + plugSpec.path = config.raw_plugin_dir .. '/' .. plugSpec.script_type .. '/' .. plugSpec.name if not add_raw_rtp then - vim.opt:append(config.raw_plugin_dir) + vim.opt.runtimepath:append(config.raw_plugin_dir) add_raw_rtp = true end end