1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-14 05:58:00 +08:00

feat(nvim-plug): support raw plugin

This commit is contained in:
Eric Wong 2025-02-08 22:47:33 +08:00
parent 2fe9e8fc11
commit 68eaa0ec0f
No known key found for this signature in database
GPG Key ID: 41BB7053E835C848
6 changed files with 384 additions and 283 deletions

View File

@ -1,168 +1,185 @@
# nvim-plug # nvim-plug
> _nvim-plug_ is a simple plugin manager for neovim > _nvim-plug_ is a simple plugin manager for neovim
[![](https://spacevim.org/img/build-with-SpaceVim.svg)](https://spacevim.org) [![](https://spacevim.org/img/build-with-SpaceVim.svg)](https://spacevim.org)
[![GPLv3 License](https://img.spacevim.org/license-GPLv3-blue.svg)](LICENSE) [![GPLv3 License](https://img.spacevim.org/license-GPLv3-blue.svg)](LICENSE)
**Alpha version. Any changes, including backward incompatible changes, are applied without announcements.** **Alpha version. Any changes, including backward incompatible changes, are applied without announcements.**
![Image](https://github.com/user-attachments/assets/93b04c48-4f41-46aa-b7f7-6390ee9622c7) ![Image](https://github.com/user-attachments/assets/93b04c48-4f41-46aa-b7f7-6390ee9622c7)
<!-- vim-markdown-toc GFM --> <!-- vim-markdown-toc GFM -->
- [Intro](#intro) - [Intro](#intro)
- [Features](#features) - [Features](#features)
- [Usage](#usage) - [Usage](#usage)
- [Plugin Spec](#plugin-spec) - [Plugin Spec](#plugin-spec)
- [Commands](#commands) - [Commands](#commands)
- [Default UI](#default-ui) - [Default UI](#default-ui)
- [Custom Plugin UI](#custom-plugin-ui) - [Custom Plugin UI](#custom-plugin-ui)
- [Feedback](#feedback) - [Feedback](#feedback)
<!-- vim-markdown-toc --> <!-- vim-markdown-toc -->
## Intro ## Intro
nvim-plug is an asynchronous Neovim plugin manager written in Lua. nvim-plug is an asynchronous Neovim plugin manager written in Lua.
## Features ## Features
- **faster:** written in lua. - **faster:** written in lua.
- **async:** downloading and building via job. - **async:** downloading and building via job.
- **lazy loading:** lazy load plugin based on events, comamnd, mapping, etc.. - **lazy loading:** lazy load plugin based on events, comamnd, mapping, etc..
- **custom UI:** provide custom UI API. - **custom UI:** provide custom UI API.
## Usage ## Usage
setup nvim-plug: setup nvim-plug:
```lua ```lua
require('plug').setup({ require('plug').setup({
bundle_dir = 'D:/bundle_dir', -- set the bundle dir
max_processes = 5, -- max number of processes used for nvim-plug job bundle_dir = 'D:/bundle_dir',
base_url = 'https://github.com', -- set the path where raw plugin is download to
ui = 'notify', -- default ui is `notify`, use `default` for split window UI raw_plugin_dir = 'D:/bundle_dir/raw_plugin',
http_proxy = 'http://127.0.0.1:7890', -- default is nil -- max number of processes used for nvim-plug job
https_proxy = 'http://127.0.0.1:7890', -- default is nil max_processes = 5,
clone_depth = 1 -- default history depth for `git clone` base_url = 'https://github.com',
}) -- default ui is `notify`, use `default` for split window UI
``` ui = 'notify',
-- default is nil
add plugins: http_proxy = 'http://127.0.0.1:7890',
-- default is nil
```lua https_proxy = 'http://127.0.0.1:7890',
-- default history depth for `git clone`
require('plug').add({ clone_depth = 1,
{ })
'wsdjeg/scrollbar.vim', ```
events = { 'VimEnter' },
config = function() end, add plugins:
},
{ ```lua
'wsdjeg/vim-chat', require('plug').add({
enabled = function() {
return vim.fn.has('nvim-0.10.0') == 1 'wsdjeg/scrollbar.vim',
end, events = { 'VimEnter' },
}, config = function() end,
{ },
'wsdjeg/flygrep.nvim', {
cmds = { 'FlyGrep' }, 'wsdjeg/vim-chat',
config = function() enabled = function()
require('flygrep').setup() return vim.fn.has('nvim-0.10.0') == 1
end, end,
}, },
{ {
'D:/wsdjeg/winbar.nvim', 'wsdjeg/flygrep.nvim',
events = { 'VimEnter' }, cmds = { 'FlyGrep' },
}, config = function()
{ require('flygrep').setup()
'wsdjeg/vim-mail', end,
on_func = 'mail#', },
}, {
}) type = 'raw',
``` url = 'https://gist.githubusercontent.com/wsdjeg/4ac99019c5ca156d35704550648ba321/raw/4e8c202c74e98b5d56616c784bfbf9b873dc8868/markdown.vim',
script_type = 'after/syntax'
## Plugin Spec },
{
| name | description | 'D:/wsdjeg/winbar.nvim',
| --------- | --------------------------------------------------------------------------------------- | events = { 'VimEnter' },
| `[1]` | `string`, plugin repo short name, `wsdjeg/flygrep.nvim` | },
| `cmds` | `table<string>`, commands lazy loading | {
| `events` | `table<string>`, events lazy loading | 'wsdjeg/vim-mail',
| `on_ft` | `table<string>`, filetypes lazy loading | on_func = 'mail#',
| `on_map` | `table<string>`, key bindings lazy loading | },
| `on_func` | `string` or `table<string>`, vim function lazy loading | })
| `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 | ## Plugin Spec
| `frozen` | update only when specific with `PlugUpdate name` |
| `depends` | `table<PluginSpec>` a list of plugins | The plugin spec is inspired by dein.nvim.
## Commands | name | description |
| ------------- | ---------------------------------------------------------------------------------------------------- |
- `:PlugInstall`: install specific plugin or all plugins | `[1]` | `string`, plugin repo short name, `wsdjeg/flygrep.nvim` |
- `:PlugUpdate`: update specific plugin or all plugins | `cmds` | `table<string>`, commands lazy loading |
| `events` | `table<string>`, events lazy loading |
## Default UI | `on_ft` | `table<string>`, filetypes lazy loading |
| `on_map` | `table<string>`, key bindings lazy loading |
The default is ui is inspired by [vundle](https://github.com/VundleVim/Vundle.vim) | `on_func` | `string` or `table<string>`, vim function lazy loading |
| `script_type` | `string`, plugin type including `color`, `plugin`, etc.. |
The default highlight group. | `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 |
| highlight group name | description | | `frozen` | update only when specific with `PlugUpdate name` |
| -------------------- | ------------------------------- | | `depends` | `table<PluginSpec>` a list of plugins |
| `PlugTitle` | the first line of plugin window | | `branch` | `string` specific git branch |
| `PlugProcess` | the process of downloading | | `tag` | `string` specific git tag |
| `PlugDone` | clone/build/install done | | `type` | `string` specific plugin type, this can be git, raw or none, if it is raw, `script_type` must be set |
| `PlugFailed` | clone/build/install failed |
| `PlugDoing` | job is running | ## Commands
Default highlight link: - `:PlugInstall`: install specific plugin or all plugins
- `:PlugUpdate`: update specific plugin or all plugins
```lua
vim.cmd('hi def link PlugTitle TODO') ## Default UI
vim.cmd('hi def link PlugProcess Repeat')
vim.cmd('hi def link PlugDone Type') The default is ui is inspired by [vundle](https://github.com/VundleVim/Vundle.vim)
vim.cmd('hi def link PlugFailed WarningMsg')
vim.cmd('hi def link PlugDoing Number') The default highlight group.
```
| highlight group name | description |
## Custom Plugin UI | -------------------- | ------------------------------- |
| `PlugTitle` | the first line of plugin window |
To setup custom UI, you need to creat a on_update function, this function is called with two arges, `name` and `plugUiData`. | `PlugProcess` | the process of downloading |
| `PlugDone` | clone/build/install done |
The plugUiData is table with following keys: | `PlugFailed` | clone/build/install failed |
| `PlugDoing` | job is running |
| key | description |
| --------------- | ---------------------------------------------------- | Default highlight link:
| `clone_done` | boolead, is true when clone successfully |
| `command` | string, clone, pull or build | ```lua
| `clone_process` | string, git clone progress, such as `16% (160/1000)` | vim.cmd('hi def link PlugTitle TODO')
| `clone_done` | boolean, git clone exit status | vim.cmd('hi def link PlugProcess Repeat')
| `building` | boolean | vim.cmd('hi def link PlugDone Type')
| `build_done` | boolean | vim.cmd('hi def link PlugFailed WarningMsg')
| `pull_done` | boolean | vim.cmd('hi def link PlugDoing Number')
| `pull_process` | string | ```
```lua ## Custom Plugin UI
--- your custom UI
To setup custom UI, you need to creat a on_update function, this function is called with two arges, `name` and `plugUiData`.
local function on_ui_update(name, data)
-- logic The plugUiData is table with following keys:
end
| key | description |
| --------------- | ---------------------------------------------------- |
require('plug').setup({ | `clone_done` | boolead, is true when clone successfully |
bundle_dir = 'D:/bundle_dir', | `command` | string, clone, pull or build |
max_processes = 5, -- max number of processes used for nvim-plug job | `clone_process` | string, git clone progress, such as `16% (160/1000)` |
base_url = 'https://github.com', | `clone_done` | boolean, git clone exit status |
ui = on_ui_update, -- default ui is notify, use `default` for split window UI | `building` | boolean |
}) | `build_done` | boolean |
``` | `pull_done` | boolean |
| `pull_process` | string |
## Feedback
```lua
The development of this plugin is in [`SpaceVim/bundle/nvim-plug`](https://github.com/SpaceVim/SpaceVim/tree/master/bundle/nvim-plug) directory. --- your custom UI
If you encounter any bugs or have suggestions, please file an issue in the [issue tracker](https://github.com/SpaceVim/SpaceVim/issues) or [Telegram group](https://t.me/+w27TxYbUz1wxZmJl) local function on_ui_update(name, data)
-- logic
end
require('plug').setup({
bundle_dir = 'D:/bundle_dir',
max_processes = 5, -- max number of processes used for nvim-plug job
base_url = 'https://github.com',
ui = on_ui_update, -- default ui is notify, use `default` for split window UI
})
```
## Feedback
The development of this plugin is in [`SpaceVim/bundle/nvim-plug`](https://github.com/SpaceVim/SpaceVim/tree/master/bundle/nvim-plug) directory.
If you encounter any bugs or have suggestions, please file an issue in the [issue tracker](https://github.com/SpaceVim/SpaceVim/issues) or [Telegram group](https://t.me/+w27TxYbUz1wxZmJl)

View File

@ -8,6 +8,7 @@
local M = {} local M = {}
M.bundle_dir = vim.fn.stdpath('data') .. '/bundle_dir' M.bundle_dir = vim.fn.stdpath('data') .. '/bundle_dir'
M.raw_plugin_dir = vim.fn.stdpath('data') .. '/bundle_dir/raw_plugin'
M.max_processes = 5 M.max_processes = 5
M.base_url = 'https://github.com/' M.base_url = 'https://github.com/'
M.ui = 'notify' M.ui = 'notify'

View File

@ -7,6 +7,8 @@
local M = {} local M = {}
local H = {}
local job = require('spacevim.api.job') local job = require('spacevim.api.job')
local notify = require('spacevim.api.notify') local notify = require('spacevim.api.notify')
local jobs = {} local jobs = {}
@ -34,9 +36,10 @@ local processes = 0
local installation_queue = {} local installation_queue = {}
local building_queue = {} local building_queue = {}
local updating_queue = {} local updating_queue = {}
local raw_download_queue = {}
--- @param plugSpec PluginSpec --- @param plugSpec PluginSpec
local function build(plugSpec) function H.build(plugSpec)
if processes >= config.max_processes then if processes >= config.max_processes then
table.insert(building_queue, plugSpec) table.insert(building_queue, plugSpec)
return return
@ -61,7 +64,7 @@ local function build(plugSpec)
end end
processes = processes - 1 processes = processes - 1
if #building_queue > 0 then if #building_queue > 0 then
build(table.remove(building_queue)) H.build(table.remove(building_queue))
end end
end, end,
cwd = plugSpec.path, cwd = plugSpec.path,
@ -75,7 +78,44 @@ local function build(plugSpec)
end end
--- @param plugSpec PluginSpec --- @param plugSpec PluginSpec
local function install_plugin(plugSpec) function H.download_raw(plugSpec, force)
if processes >= config.max_processes then
table.insert(raw_download_queue, plugSpec)
return
elseif vim.fn.filereadable(plugSpec.path) == 1 and not force then
on_uidate(plugSpec.name, { command = 'curl', curl_done = true })
return
end
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
on_uidate(plugSpec.name, { curl_done = true })
else
on_uidate(plugSpec.name, { curl_done = false })
end
processes = processes - 1
if #installation_queue > 0 then
H.install_plugin(table.remove(installation_queue, 1))
elseif #building_queue > 0 then
H.build(table.remove(building_queue, 1))
end
end,
env = {
http_proxy = config.http_proxy,
https_proxy = config.https_proxy,
},
})
processes = processes + 1
jobs['jobid_' .. jobid] = plugSpec.name
end
--- @param plugSpec PluginSpec
function H.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
@ -113,16 +153,16 @@ local function install_plugin(plugSpec)
if data == 0 and single == 0 then if data == 0 and single == 0 then
on_uidate(plugSpec.name, { clone_done = true, download_process = 100 }) on_uidate(plugSpec.name, { clone_done = true, download_process = 100 })
if plugSpec.build then if plugSpec.build then
build(plugSpec) H.build(plugSpec)
end end
else else
on_uidate(plugSpec.name, { clone_done = false, download_process = 0 }) on_uidate(plugSpec.name, { clone_done = false, download_process = 0 })
end end
processes = processes - 1 processes = processes - 1
if #installation_queue > 0 then if #installation_queue > 0 then
install_plugin(table.remove(installation_queue, 1)) H.install_plugin(table.remove(installation_queue, 1))
elseif #building_queue > 0 then elseif #building_queue > 0 then
build(table.remove(building_queue, 1)) H.build(table.remove(building_queue, 1))
end end
end, end,
env = { env = {
@ -135,9 +175,9 @@ local function install_plugin(plugSpec)
end end
--- @param plugSpec PluginSpec --- @param plugSpec PluginSpec
local function update_plugin(plugSpec, force) function H.update_plugin(plugSpec, force)
if processes >= config.max_processes then if processes >= config.max_processes then
table.insert(updating_queue, {plugSpec, force}) table.insert(updating_queue, { plugSpec, force })
return return
elseif vim.fn.isdirectory(plugSpec.path) ~= 1 then elseif vim.fn.isdirectory(plugSpec.path) ~= 1 then
-- if the directory does not exist, return failed -- if the directory does not exist, return failed
@ -162,16 +202,16 @@ local function update_plugin(plugSpec, force)
if data == 0 and single == 0 then if data == 0 and single == 0 then
on_uidate(plugSpec.name, { pull_done = true }) on_uidate(plugSpec.name, { pull_done = true })
if plugSpec.build then if plugSpec.build then
build(plugSpec) H.build(plugSpec)
end end
else else
on_uidate(plugSpec.name, { pull_done = false }) on_uidate(plugSpec.name, { pull_done = false })
end end
processes = processes - 1 processes = processes - 1
if #updating_queue > 0 then if #updating_queue > 0 then
update_plugin(unpack(table.remove(updating_queue, 1))) H.update_plugin(unpack(table.remove(updating_queue, 1)))
elseif #building_queue > 0 then elseif #building_queue > 0 then
build(table.remove(building_queue, 1)) H.build(table.remove(building_queue, 1))
end end
end, end,
cwd = plugSpec.path, cwd = plugSpec.path,
@ -190,13 +230,21 @@ end
M.install = function(plugSpecs) M.install = function(plugSpecs)
for _, v in ipairs(plugSpecs) do for _, v in ipairs(plugSpecs) do
install_plugin(v) if v.type == 'raw' then
H.download_raw(v)
else
H.install_plugin(v)
end
end end
end end
M.update = function(plugSpecs, force) M.update = function(plugSpecs, force)
for _, v in ipairs(plugSpecs) do for _, v in ipairs(plugSpecs) do
update_plugin(v, force) if v.type == 'raw' then
H.download_raw(v, force)
else
H.update_plugin(v, force)
end
end end
end end

View File

@ -1,102 +1,123 @@
--============================================================================= --=============================================================================
-- loader.lua -- loader.lua
-- Copyright 2025 Eric Wong -- Copyright 2025 Eric Wong
-- Author: Eric Wong < wsdjeg@outlook.com > -- Author: Eric Wong < wsdjeg@outlook.com >
-- License: GPLv3 -- License: GPLv3
--============================================================================= --=============================================================================
local M = {} local M = {}
local config = require('plug.config') local config = require('plug.config')
--- @class PluginSpec local add_raw_rtp = false
--- @field rtp string
--- @field events table<string> --- @class PluginSpec
--- @field cmds table<string> --- @field rtp string
--- @field config function --- @field events table<string>
--- @field name string --- @field cmds table<string>
--- @field branch string --- @field config function
--- @field tag string --- @field name string
--- @field url string --- @field branch string
--- @field path string --- @field tag string
--- @field build string|table<string> --- @field url string
--- @field is_local boolean true for local plugin --- @field path string
--- @field when boolean|string|function --- @field build string|table<string>
--- @field frozen boolean --- @field is_local boolean true for local plugin
--- @field when boolean|string|function
local function is_local_plugin(plugSpec) --- @field frozen boolean
if plugSpec.is_local or vim.fn.isdirectory(plugSpec[1]) == 1 then --- @field type string "git", "raw" or "none"
plugSpec.is_local = true --- @field script_type string "git", "raw" or "none"
return true
end local function is_local_plugin(plugSpec)
end if plugSpec.is_local or vim.fn.isdirectory(plugSpec[1]) == 1 then
plugSpec.is_local = true
local function unique_name(plugSpec) return true
local s = vim.split(plugSpec[1], '/') end
return s[#s] end
end
local function check_name(plugSpec)
function M.parser(plugSpec) if not plugSpec[1] and not plugSpec.url then
if type(plugSpec.enabled) == "nil" then return false
plugSpec.enabled = true end
elseif type(plugSpec.enabled) == "function" then local s = vim.split(plugSpec[1] or plugSpec.url, '/')
plugSpec.enabled = plugSpec.enabled() plugSpec.name = s[#s]
elseif type(plugSpec.enabled) ~= "boolean" or plugSpec.enabled == false then return true
plugSpec.enabled = false end
return plugSpec
end function M.parser(plugSpec)
plugSpec.name = unique_name(plugSpec) if type(plugSpec.enabled) == 'nil' then
if is_local_plugin(plugSpec) then plugSpec.enabled = true
plugSpec.rtp = plugSpec[1] elseif type(plugSpec.enabled) == 'function' then
plugSpec.path = plugSpec[1] plugSpec.enabled = plugSpec.enabled()
plugSpec.url = nil elseif type(plugSpec.enabled) ~= 'boolean' or plugSpec.enabled == false then
elseif not plugSpec.type or plugSpec.type == 'none' then plugSpec.enabled = false
plugSpec.rtp = config.bundle_dir .. '/' .. plugSpec[1] return plugSpec
plugSpec.path = config.bundle_dir .. '/' .. plugSpec[1] elseif not check_name(plugSpec) then
plugSpec.url = config.base_url .. '/' .. plugSpec[1] plugSpec.enabled = false
elseif plugSpec.type == 'color' then return plugSpec
plugSpec.rtp = config.bundle_dir .. '/' .. plugSpec[1] end
plugSpec.path = config.bundle_dir .. '/' .. plugSpec[1] .. '/color' if is_local_plugin(plugSpec) then
plugSpec.repo = config.base_url .. '/' .. plugSpec[1] plugSpec.rtp = plugSpec[1]
elseif plugSpec.type == 'plugin' then plugSpec.path = plugSpec[1]
plugSpec.rtp = config.bundle_dir .. '/' .. plugSpec[1] plugSpec.url = nil
plugSpec.path = config.bundle_dir .. '/' .. plugSpec[1] .. '/plugin' elseif plugSpec.type == 'raw' then
plugSpec.url = config.base_url .. '/' .. plugSpec[1] if not plugSpec.script_type or plugSpec.script_type == 'none' then
end plugSpec.enabled = false
return plugSpec
return plugSpec else
end plugSpec.path = config.raw_plugin_dir .. '/' .. plugSpec.script_type .. plugSpec.name
if not add_raw_rtp then
-- {'loadconf': 1, vim.opt:append(config.raw_plugin_dir)
-- 'type': 'none', add_raw_rtp = true
-- 'overwrite': 1, end
-- 'lazy': 0, end
-- 'name': 'defx-git', elseif not plugSpec.script_type or plugSpec.script_type == 'none' then
-- 'rtp': 'C:/Users/wsdjeg/.SpaceVim/bundle/defx-git', plugSpec.rtp = config.bundle_dir .. '/' .. plugSpec[1]
-- 'normalized_name': 'defx-git', plugSpec.path = config.bundle_dir .. '/' .. plugSpec[1]
-- 'local': 1, plugSpec.url = config.base_url .. '/' .. plugSpec[1]
-- 'sourced': 1, elseif plugSpec.script_type == 'color' then
-- 'orig_opts': {'repo': 'C:/Users/wsdjeg/.SpaceVim/bundle/defx-git', plugSpec.rtp = config.bundle_dir .. '/' .. plugSpec[1]
-- 'loadconf': 1, plugSpec.path = config.bundle_dir .. '/' .. plugSpec[1] .. '/color'
-- 'type': 'none', plugSpec.repo = config.base_url .. '/' .. plugSpec[1]
-- 'merged': 0, elseif plugSpec.script_type == 'plugin' then
-- 'hook_source': 'call SpaceVim#util#loadConfig(''plugins/defx-git.vim'')', plugSpec.rtp = config.bundle_dir .. '/' .. plugSpec[1]
-- 'overwrite': 1}, plugSpec.path = config.bundle_dir .. '/' .. plugSpec[1] .. '/plugin'
-- 'repo': 'C:/Users/wsdjeg/.SpaceVim/bundle/defx-git', plugSpec.url = config.base_url .. '/' .. plugSpec[1]
-- 'hook_source': 'call SpaceVim#util#loadConfig(''plugins/defx-git.vim'')', end
-- 'called': {'''call SpaceVim#util#loadConfig(''''plugins/defx-git.vim'''')''': v:true},
-- 'merged': 0, return plugSpec
-- 'path': 'C:/Users/wsdjeg/.SpaceVim/bundle/defx-git'} end
function M.load(plugSpec)
if vim.fn.isdirectory(plugSpec.rtp) == 1 then -- {'loadconf': 1,
vim.opt.runtimepath:append(plugSpec.rtp) -- 'type': 'none',
if vim.fn.has('vim_starting') ~= 1 then -- 'overwrite': 1,
local plugin_directory_files = vim.fn.globpath(plugSpec.rtp, "plugin/*.{lua,vim}", 0, 1) -- 'lazy': 0,
for _, f in ipairs(plugin_directory_files) do -- 'name': 'defx-git',
vim.cmd.source(f) -- 'rtp': 'C:/Users/wsdjeg/.SpaceVim/bundle/defx-git',
end -- 'normalized_name': 'defx-git',
end -- 'local': 1,
end -- 'sourced': 1,
end -- 'orig_opts': {'repo': 'C:/Users/wsdjeg/.SpaceVim/bundle/defx-git',
-- 'loadconf': 1,
return M -- 'type': 'none',
-- 'merged': 0,
-- 'hook_source': 'call SpaceVim#util#loadConfig(''plugins/defx-git.vim'')',
-- 'overwrite': 1},
-- 'repo': 'C:/Users/wsdjeg/.SpaceVim/bundle/defx-git',
-- 'hook_source': 'call SpaceVim#util#loadConfig(''plugins/defx-git.vim'')',
-- 'called': {'''call SpaceVim#util#loadConfig(''''plugins/defx-git.vim'''')''': v:true},
-- 'merged': 0,
-- 'path': 'C:/Users/wsdjeg/.SpaceVim/bundle/defx-git'}
function M.load(plugSpec)
if plugSpec.rtp and vim.fn.isdirectory(plugSpec.rtp) == 1 then
vim.opt.runtimepath:append(plugSpec.rtp)
if vim.fn.has('vim_starting') ~= 1 then
local plugin_directory_files = vim.fn.globpath(plugSpec.rtp, 'plugin/*.{lua,vim}', 0, 1)
for _, f in ipairs(plugin_directory_files) do
vim.cmd.source(f)
end
end
end
end
return M

View File

@ -72,6 +72,14 @@ local function build_context()
else else
table.insert(b, '- ' .. k) table.insert(b, '- ' .. k)
end end
elseif plug.command == 'curl' then
if plug.curl_done then
table.insert(b, '' .. k .. ' download')
elseif plug.curl_done == false then
table.insert(b, '× ' .. k .. ' failed to download')
else
table.insert(b, '- ' .. k .. string.format(' downloading'))
end
end end
end end

View File

@ -11,6 +11,7 @@ vim.opt.runtimepath:append('~/.SpaceVim')
require('plug').setup({ require('plug').setup({
bundle_dir = 'D:/bundle_dir', bundle_dir = 'D:/bundle_dir',
raw_plugin_dir = 'D:/bundle_dir/raw_plugin',
ui = 'default', ui = 'default',
http_proxy = 'http://127.0.0.1:7890', http_proxy = 'http://127.0.0.1:7890',
https_proxy = 'http://127.0.0.1:7890', https_proxy = 'http://127.0.0.1:7890',
@ -21,6 +22,11 @@ require('plug').add({
'wsdjeg/SourceCounter.vim', 'wsdjeg/SourceCounter.vim',
cmds = { 'SourceCounter' }, cmds = { 'SourceCounter' },
}, },
{
type = 'raw',
url = 'https://gist.githubusercontent.com/wsdjeg/4ac99019c5ca156d35704550648ba321/raw/4e8c202c74e98b5d56616c784bfbf9b873dc8868/markdown.vim',
script_type = 'after/syntax'
},
{ {
'wsdjeg/git.vim', 'wsdjeg/git.vim',
cmds = { 'Git' }, cmds = { 'Git' },