mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-14 05:37:57 +08:00
feat(nvim-plug): support local plugins
This commit is contained in:
parent
8a4834b360
commit
a842704063
3
bundle/nvim-plug/lua/plug/installer.lua
vendored
3
bundle/nvim-plug/lua/plug/installer.lua
vendored
@ -55,6 +55,9 @@ local function install_plugin(plugSpec)
|
|||||||
if processes >= config.max_processes then
|
if processes >= config.max_processes then
|
||||||
table.insert(installation_queue, plugSpec)
|
table.insert(installation_queue, plugSpec)
|
||||||
return
|
return
|
||||||
|
elseif vim.fn.isdirectory(plugSpec.path) == 1 then
|
||||||
|
-- if the directory exists, skip installation
|
||||||
|
return
|
||||||
end
|
end
|
||||||
local cmd = { 'git', 'clone', '--depth', '1' }
|
local cmd = { 'git', 'clone', '--depth', '1' }
|
||||||
if plugSpec.branch then
|
if plugSpec.branch then
|
||||||
|
21
bundle/nvim-plug/lua/plug/loader.lua
vendored
21
bundle/nvim-plug/lua/plug/loader.lua
vendored
@ -20,10 +20,27 @@ local config = require('plug.config')
|
|||||||
--- @field url string
|
--- @field url string
|
||||||
--- @field path string
|
--- @field path string
|
||||||
--- @field build string|table<string>
|
--- @field build string|table<string>
|
||||||
|
--- @field is_local boolean true for local plugin
|
||||||
|
|
||||||
|
local function is_local_plugin(plugSpec)
|
||||||
|
if plugSpec.is_local or vim.fn.isdirectory(plugSpec[1]) == 1 then
|
||||||
|
plugSpec.is_local = true
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function unique_name(plugSpec)
|
||||||
|
local s = vim.split(plugSpec, '/')
|
||||||
|
return s[#s]
|
||||||
|
end
|
||||||
|
|
||||||
function M.parser(plugSpec)
|
function M.parser(plugSpec)
|
||||||
plugSpec.name = vim.split(plugSpec[1], '/')[2]
|
plugSpec.name = unique_name(plugSpec)
|
||||||
if not plugSpec.type or plugSpec.type == 'none' then
|
if is_local_plugin(plugSpec) then
|
||||||
|
plugSpec.rtp = plugSpec[1]
|
||||||
|
plugSpec.path = plugSpec[1]
|
||||||
|
plugSpec.url = nil
|
||||||
|
elseif not plugSpec.type or plugSpec.type == 'none' then
|
||||||
plugSpec.rtp = config.bundle_dir .. '/' .. plugSpec[1]
|
plugSpec.rtp = config.bundle_dir .. '/' .. plugSpec[1]
|
||||||
plugSpec.path = config.bundle_dir .. '/' .. plugSpec[1]
|
plugSpec.path = config.bundle_dir .. '/' .. plugSpec[1]
|
||||||
plugSpec.url = config.base_url .. '/' .. plugSpec[1]
|
plugSpec.url = config.base_url .. '/' .. plugSpec[1]
|
||||||
|
Loading…
Reference in New Issue
Block a user