From 1d63b392be126bc9677e8155c47164e0b2434196 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 12 Feb 2025 01:21:47 +0800 Subject: [PATCH] feat(installer): skip local plugin --- bundle/nvim-plug/lua/plug/installer.lua | 14 ++++++++------ bundle/nvim-plug/lua/plug/loader.lua | 7 +++++-- bundle/nvim-plug/lua/plug/ui.lua | 6 ++++-- bundle/nvim-plug/test/init.lua | 3 +++ 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/bundle/nvim-plug/lua/plug/installer.lua b/bundle/nvim-plug/lua/plug/installer.lua index adaae37cf..1152ab58f 100644 --- a/bundle/nvim-plug/lua/plug/installer.lua +++ b/bundle/nvim-plug/lua/plug/installer.lua @@ -92,8 +92,8 @@ function H.download_raw(plugSpec, force) return end - local cmd = {'curl', '-fLo', plugSpec.path, '--create-dirs', plugSpec.url} - on_uidate(plugSpec.name, { command = 'curl'}) + local cmd = { 'curl', '-fLo', plugSpec.path, '--create-dirs', plugSpec.url } + on_uidate(plugSpec.name, { command = 'curl' }) local jobid = job.start(cmd, { on_exit = function(id, data, single) if data == 0 and single == 0 then @@ -115,8 +115,6 @@ function H.download_raw(plugSpec, force) }) processes = processes + 1 jobs['jobid_' .. jobid] = plugSpec.name - - end --- @param plugSpec PluginSpec @@ -237,7 +235,9 @@ end M.install = function(plugSpecs) for _, v in ipairs(plugSpecs) do - if v.type == 'raw' then + if v.is_local then + on_uidate(v.name, {is_local = true}) + elseif v.type == 'raw' then H.download_raw(v) else H.install_plugin(v) @@ -247,7 +247,9 @@ end M.update = function(plugSpecs, force) for _, v in ipairs(plugSpecs) do - if v.type == 'raw' then + if v.is_local then + on_uidate(v.name, {is_local = true}) + elseif v.type == 'raw' then H.download_raw(v, force) else H.update_plugin(v, force) diff --git a/bundle/nvim-plug/lua/plug/loader.lua b/bundle/nvim-plug/lua/plug/loader.lua index 0fd31b7e4..c5997723b 100644 --- a/bundle/nvim-plug/lua/plug/loader.lua +++ b/bundle/nvim-plug/lua/plug/loader.lua @@ -12,7 +12,6 @@ local config = require('plug.config') local add_raw_rtp = false local loaded_plugins = {} - --- @class PluginSpec --- @field rtp string --- @field events table @@ -108,7 +107,11 @@ function M.parser(plugSpec) end function M.load(plugSpec) - if plugSpec.rtp and vim.fn.isdirectory(plugSpec.rtp) == 1 and not loaded_plugins[plugSpec.name] then + if + plugSpec.rtp + and vim.fn.isdirectory(plugSpec.rtp) == 1 + and not loaded_plugins[plugSpec.name] + then vim.opt.runtimepath:append(plugSpec.rtp) loaded_plugins[plugSpec.name] = true if type(plugSpec.config) == 'function' then diff --git a/bundle/nvim-plug/lua/plug/ui.lua b/bundle/nvim-plug/lua/plug/ui.lua index cb936e344..10d1713fd 100644 --- a/bundle/nvim-plug/lua/plug/ui.lua +++ b/bundle/nvim-plug/lua/plug/ui.lua @@ -17,7 +17,7 @@ local plugin_status = {} local function count_done(p) done = 0 for _, v in pairs(p) do - if v.command and v[v.command .. '_done'] then + if v.command and v[v.command .. '_done'] or v.is_local then done = done + 1 end end @@ -42,7 +42,9 @@ local function build_context() local b = base() for k, plug in pairs(plugin_status) do - if plug.command == 'pull' then + if plug.is_local then + table.insert(b, '√ ' .. k .. ' skip local plugin') + elseif plug.command == 'pull' then if plug.pull_done then table.insert(b, '√ ' .. k .. ' updated') elseif plug.pull_done == false then diff --git a/bundle/nvim-plug/test/init.lua b/bundle/nvim-plug/test/init.lua index d614903e3..b2ad1aafa 100644 --- a/bundle/nvim-plug/test/init.lua +++ b/bundle/nvim-plug/test/init.lua @@ -41,6 +41,9 @@ require('plug').add({ } } }, + { + 'D:/wsdjeg/winbar2.nvim', + }, { 'wsdjeg/vim-async-dict', frozen = true,