mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-14 05:58:00 +08:00
fix(nvim-plug): fix raw plugin support
This commit is contained in:
parent
68eaa0ec0f
commit
7ad09214c0
1
bundle/nvim-plug/lua/plug/config.lua
vendored
1
bundle/nvim-plug/lua/plug/config.lua
vendored
@ -21,6 +21,7 @@ function M.setup(opt)
|
|||||||
M.http_proxy = opt.http_proxy
|
M.http_proxy = opt.http_proxy
|
||||||
M.https_proxy = opt.https_proxy
|
M.https_proxy = opt.https_proxy
|
||||||
M.clone_depth = opt.clone_depth or M.clone_depth
|
M.clone_depth = opt.clone_depth or M.clone_depth
|
||||||
|
M.raw_plugin_dir = opt.raw_plugin_dir or M.raw_plugin_dir
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
26
bundle/nvim-plug/lua/plug/loader.lua
vendored
26
bundle/nvim-plug/lua/plug/loader.lua
vendored
@ -28,20 +28,24 @@ local add_raw_rtp = false
|
|||||||
--- @field type string "git", "raw" or "none"
|
--- @field type string "git", "raw" or "none"
|
||||||
--- @field script_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)
|
local function is_local_plugin(plugSpec)
|
||||||
if plugSpec.is_local or vim.fn.isdirectory(plugSpec[1]) == 1 then
|
if plugSpec.is_local or vim.fn.isdirectory(plugSpec[1]) == 1 then
|
||||||
plugSpec.is_local = true
|
plugSpec.is_local = true
|
||||||
return true
|
return true
|
||||||
end
|
else
|
||||||
end
|
|
||||||
|
|
||||||
local function check_name(plugSpec)
|
|
||||||
if not plugSpec[1] and not plugSpec.url then
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
--- @param plugSpec PluginSpec
|
||||||
|
--- @return string
|
||||||
|
local function check_name(plugSpec)
|
||||||
|
if not plugSpec[1] and not plugSpec.url then
|
||||||
|
return ''
|
||||||
|
end
|
||||||
local s = vim.split(plugSpec[1] or plugSpec.url, '/')
|
local s = vim.split(plugSpec[1] or plugSpec.url, '/')
|
||||||
plugSpec.name = s[#s]
|
return s[#s]
|
||||||
return true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.parser(plugSpec)
|
function M.parser(plugSpec)
|
||||||
@ -52,7 +56,9 @@ function M.parser(plugSpec)
|
|||||||
elseif type(plugSpec.enabled) ~= 'boolean' or plugSpec.enabled == false then
|
elseif type(plugSpec.enabled) ~= 'boolean' or plugSpec.enabled == false then
|
||||||
plugSpec.enabled = false
|
plugSpec.enabled = false
|
||||||
return plugSpec
|
return plugSpec
|
||||||
elseif not check_name(plugSpec) then
|
end
|
||||||
|
plugSpec.name = check_name(plugSpec)
|
||||||
|
if #plugSpec.name == 0 then
|
||||||
plugSpec.enabled = false
|
plugSpec.enabled = false
|
||||||
return plugSpec
|
return plugSpec
|
||||||
end
|
end
|
||||||
@ -65,9 +71,9 @@ function M.parser(plugSpec)
|
|||||||
plugSpec.enabled = false
|
plugSpec.enabled = false
|
||||||
return plugSpec
|
return plugSpec
|
||||||
else
|
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
|
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
|
add_raw_rtp = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user