2025-02-04 23:27:02 +08:00
# nvim-plug
> _nvim-plug_ is a simple plugin manager for neovim
[![ ](https://spacevim.org/img/build-with-SpaceVim.svg )](https://spacevim.org)
[![GPLv3 License ](https://img.spacevim.org/license-GPLv3-blue.svg )](LICENSE)
2025-02-04 23:50:08 +08:00
**Alpha version. Any changes, including backward incompatible changes, are applied without announcements.**
2025-02-07 13:03:04 +08:00
![Image ](https://github.com/user-attachments/assets/93b04c48-4f41-46aa-b7f7-6390ee9622c7 )
<!-- vim - markdown - toc GFM -->
- [Intro ](#intro )
- [Features ](#features )
- [Usage ](#usage )
- [Plugin Spec ](#plugin-spec )
- [Commands ](#commands )
- [Default UI ](#default-ui )
- [Custom Plugin UI ](#custom-plugin-ui )
- [Feedback ](#feedback )
<!-- vim - markdown - toc -->
## Intro
2025-02-07 13:05:57 +08:00
nvim-plug is an asynchronous Neovim plugin manager written in Lua.
2025-02-07 13:03:04 +08:00
## Features
- **faster:** written in lua.
- **async:** downloading and building via job.
- **lazy loading:** lazy load plugin based on events, comamnd, mapping, etc..
- **custom UI:** provide custom UI API.
2025-02-04 23:27:02 +08:00
## Usage
```lua
2025-02-04 23:57:15 +08:00
require('plug').setup({
bundle_dir = 'D:/bundle_dir',
2025-02-05 00:43:02 +08:00
max_processes = 5, -- max number of processes used for nvim-plug job
base_url = 'https://github.com',
2025-02-05 22:27:16 +08:00
ui = 'notify', -- default ui is notify, use `default` for split window UI
2025-02-04 23:27:02 +08:00
})
2025-02-04 23:57:15 +08:00
require('plug').add({
{
'wsdjeg/scrollbar.vim',
events = { 'VimEnter' },
config = function() end,
},
2025-02-05 10:03:37 +08:00
{
'wsdjeg/vim-chat',
enabled = function()
return vim.fn.has('nvim-0.10.0') == 1
end,
},
2025-02-04 23:57:15 +08:00
{
'wsdjeg/flygrep.nvim',
cmds = { 'FlyGrep' },
config = function()
require('flygrep').setup()
end,
},
2025-02-05 00:58:34 +08:00
{
'D:/wsdjeg/winbar.nvim',
events = { 'VimEnter' },
},
2025-02-04 23:27:02 +08:00
})
```
## Plugin Spec
2025-02-05 11:31:31 +08:00
| name | description |
| --------- | --------------------------------------------------------------------------------------- |
| `[1]` | `string` , plugin repo short name, `wsdjeg/flygrep.nvim` |
| `cmds` | `table<string>` , commands lazy loading |
| `events` | `table<string>` , events lazy loading |
| `on_ft` | `table<string>` , filetypes lazy loading |
| `on_map` | `table<string>` , key bindings lazy loading |
| `type` | `string` , plugin type including `color` , `plugin` |
| `build` | `string` or `table<string>` , executed by [job ](https://spacevim.org/api/job/ ) api |
2025-02-05 10:03:37 +08:00
| `enabled` | `boolean` or `function` evaluated when startup, when it is false, plugin will be skiped |
2025-02-04 23:27:02 +08:00
## Commands
- `:PlugInstall` : install specific plugin
2025-02-06 13:37:31 +08:00
## Default UI
The default is ui is inspired by [vundle ](https://github.com/VundleVim/Vundle.vim )
The default highlight group.
| highlight group name | description |
| -------------------- | ------------------------------- |
| `PlugTitle` | the first line of plugin window |
| `PlugProcess` | the process of downloading |
2025-02-05 22:27:16 +08:00
## Custom Plugin UI
2025-02-06 13:37:31 +08:00
To setup custom UI, you need to creat a on_update function, this function is called with two arges:
2025-02-05 22:27:16 +08:00
- name: `string`
- date: `PlugUiData`
| key | description |
| ------------ | ---------------------------------------- |
| `clone_done` | boolead, is true when clone successfully |
2025-02-06 12:15:56 +08:00
```lua
--- your custom UI
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
})
```
2025-02-04 23:27:02 +08:00
## Feedback
The development of this plugin is in [`SpaceVim/bundle/nvim-plug` ](https://github.com/SpaceVim/SpaceVim/tree/master/bundle/nvim-plug ) directory.
2025-02-05 02:21:22 +08:00
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 )