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

feat(nvim-plug): load plugin after installation

This commit is contained in:
Eric Wong 2025-02-09 22:36:25 +08:00
parent 202ea3637c
commit 812d72d057
No known key found for this signature in database
GPG Key ID: 41BB7053E835C848
4 changed files with 14 additions and 0 deletions

View File

@ -118,6 +118,9 @@ The plugin spec is inspired by dein.nvim.
| `branch` | `string` specific git branch | | `branch` | `string` specific git branch |
| `tag` | `string` specific git tag | | `tag` | `string` specific git tag |
| `type` | `string` specific plugin type, this can be git, raw or none, if it is raw, `script_type` must be set | | `type` | `string` specific plugin type, this can be git, raw or none, if it is raw, `script_type` must be set |
| `autoload` | `boolean`, load plugin after git clone |
`config` and `config_after` function will be not be called if the plugin has not been installed.
## Commands ## Commands

View File

@ -13,6 +13,7 @@ local job = require('spacevim.api.job')
local notify = require('spacevim.api.notify') local notify = require('spacevim.api.notify')
local jobs = {} local jobs = {}
local config = require('plug.config') local config = require('plug.config')
local loader = require('plug.loader')
local on_uidate local on_uidate
@ -155,6 +156,8 @@ function H.install_plugin(plugSpec)
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
H.build(plugSpec) H.build(plugSpec)
elseif plugSpec.autoload then
loader.load(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 })

View File

@ -30,6 +30,7 @@ local add_raw_rtp = false
--- @field config_before function function called after update rtp --- @field config_before function function called after update rtp
--- @field config_after function function called after update rtp --- @field config_after function function called after update rtp
--- @field hook_install_done? function --- @field hook_install_done? function
--- @field autoload? boolean
--- @param plugSpec PluginSpec --- @param plugSpec PluginSpec
--- @return boolean --- @return boolean

View File

@ -51,6 +51,13 @@ require('plug').add({
events = { 'VimEnter' }, events = { 'VimEnter' },
config = function() end, config = function() end,
}, },
{
'rakr/vim-one',
events = { 'VimEnter' },
config = function()
vim.cmd('colorscheme one')
end,
},
{ {
'wsdjeg/flygrep.nvim', 'wsdjeg/flygrep.nvim',
cmds = { 'FlyGrep' }, cmds = { 'FlyGrep' },