mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-14 06:07:58 +08:00
feat(nvim-plug): add frozen
option
This commit is contained in:
parent
68b2146c17
commit
0f9396a709
1
bundle/nvim-plug/README.md
vendored
1
bundle/nvim-plug/README.md
vendored
@ -88,6 +88,7 @@ require('plug').add({
|
||||
| `type` | `string`, plugin type including `color`, `plugin` |
|
||||
| `build` | `string` or `table<string>`, executed by [job](https://spacevim.org/api/job/) api |
|
||||
| `enabled` | `boolean` or `function` evaluated when startup, when it is false, plugin will be skiped |
|
||||
| `frozen` | update only when specific with `PlugUpdate name` |
|
||||
|
||||
## Commands
|
||||
|
||||
|
13
bundle/nvim-plug/lua/plug/installer.lua
vendored
13
bundle/nvim-plug/lua/plug/installer.lua
vendored
@ -134,14 +134,17 @@ local function install_plugin(plugSpec)
|
||||
end
|
||||
|
||||
--- @param plugSpec PluginSpec
|
||||
local function update_plugin(plugSpec)
|
||||
local function update_plugin(plugSpec, force)
|
||||
if processes >= config.max_processes then
|
||||
table.insert(updating_queue, plugSpec)
|
||||
table.insert(updating_queue, {plugSpec, force})
|
||||
return
|
||||
elseif vim.fn.isdirectory(plugSpec.path) ~= 1 then
|
||||
-- if the directory does not exist, return failed
|
||||
on_uidate(plugSpec.name, { command = 'pull', pull_done = false })
|
||||
return
|
||||
elseif plugSpec.frozen and not force then
|
||||
on_uidate(plugSpec.name, { command = 'pull', pull_done = true })
|
||||
return
|
||||
end
|
||||
local cmd = { 'git', 'pull', '--progress' }
|
||||
on_uidate(plugSpec.name, { command = 'pull', pull_process = '' })
|
||||
@ -170,7 +173,7 @@ local function update_plugin(plugSpec)
|
||||
end
|
||||
processes = processes - 1
|
||||
if #updating_queue > 0 then
|
||||
update_plugin(table.remove(updating_queue, 1))
|
||||
update_plugin(unpack(table.remove(updating_queue, 1)))
|
||||
end
|
||||
end,
|
||||
cwd = plugSpec.path,
|
||||
@ -193,9 +196,9 @@ M.install = function(plugSpecs)
|
||||
end
|
||||
end
|
||||
|
||||
M.update = function(plugSpecs)
|
||||
M.update = function(plugSpecs, force)
|
||||
for _, v in ipairs(plugSpecs) do
|
||||
update_plugin(v)
|
||||
update_plugin(v, force)
|
||||
end
|
||||
end
|
||||
|
||||
|
1
bundle/nvim-plug/lua/plug/loader.lua
vendored
1
bundle/nvim-plug/lua/plug/loader.lua
vendored
@ -22,6 +22,7 @@ local config = require('plug.config')
|
||||
--- @field build string|table<string>
|
||||
--- @field is_local boolean true for local plugin
|
||||
--- @field when boolean|string|function
|
||||
--- @field frozen boolean
|
||||
|
||||
local function is_local_plugin(plugSpec)
|
||||
if plugSpec.is_local or vim.fn.isdirectory(plugSpec[1]) == 1 then
|
||||
|
4
bundle/nvim-plug/plugin/plug.lua
vendored
4
bundle/nvim-plug/plugin/plug.lua
vendored
@ -44,7 +44,7 @@ vim.api.nvim_create_user_command('PlugUpdate', function(opt)
|
||||
for _, v in pairs(all_plugins) do
|
||||
table.insert(plugs, v)
|
||||
end
|
||||
require('plug.installer').update(plugs)
|
||||
require('plug.installer').update(plugs, false)
|
||||
else
|
||||
for _, v in ipairs(opt.fargs) do
|
||||
local p = all_plugins[v]
|
||||
@ -52,7 +52,7 @@ vim.api.nvim_create_user_command('PlugUpdate', function(opt)
|
||||
table.insert(plugs, p)
|
||||
end
|
||||
end
|
||||
require('plug.installer').update(plugs)
|
||||
require('plug.installer').update(plugs, true)
|
||||
end
|
||||
local c = require('plug.config')
|
||||
if c.ui == 'default' then
|
||||
|
7
bundle/nvim-plug/test/init.lua
vendored
7
bundle/nvim-plug/test/init.lua
vendored
@ -19,19 +19,20 @@ require('plug').setup({
|
||||
require('plug').add({
|
||||
{
|
||||
'wsdjeg/SourceCounter.vim',
|
||||
cmds = {'SourceCounter'}
|
||||
cmds = { 'SourceCounter' },
|
||||
},
|
||||
{
|
||||
'wsdjeg/git.vim',
|
||||
cmds = {'Git'}
|
||||
cmds = { 'Git' },
|
||||
},
|
||||
{
|
||||
'wsdjeg/JavaUnit.vim',
|
||||
cmds = {'JavaUnit'}
|
||||
cmds = { 'JavaUnit' },
|
||||
},
|
||||
{
|
||||
'wsdjeg/vim-async-dict',
|
||||
build = 'cargo build',
|
||||
frozen = true,
|
||||
},
|
||||
{
|
||||
'wsdjeg/scrollbar.vim',
|
||||
|
Loading…
Reference in New Issue
Block a user