This commit is contained in:
62
README.md
62
README.md
@@ -36,6 +36,68 @@ code. Package managers are a developing landscape for Lua in the context of
|
||||
NeoVim. Perhaps in the future, `lux` will eliminate the need to vendor this
|
||||
library in your application code.
|
||||
|
||||
#### If you are a Plugin Author
|
||||
|
||||
Neovim does not have a good answer for automatic management of plugin dependencies. As such, it is recommended that library authors vendor u.nvim within their plugin. **u.nvim** is implemented in a single file, so this should be relatively painless. Furthermore, `lua/u.lua` versions are published into artifact tags `artifact-vX.Y.Z` as `init.lua` so that plugin authors can add u.nvim as a submodule to their plugin.
|
||||
|
||||
<details>
|
||||
<summary>Example git submodule setup</summary>
|
||||
|
||||
```bash
|
||||
# In your plugin repository
|
||||
git submodule add -- https://github.com/jrop/u.nvim lua/my_plugin/u
|
||||
cd lua/my_plugin/u/
|
||||
git checkout artifact-v0.2.0 # put whatever version of u.nvim you want to pin here
|
||||
# ... commit the submodule within your repo
|
||||
|
||||
# This would place u.nvim@v0.2.0 at:
|
||||
# lua/my_plugin/u/init.lua
|
||||
```
|
||||
|
||||
Then in your plugin code:
|
||||
|
||||
```lua
|
||||
local u = require('my_plugin.u')
|
||||
|
||||
local Pos = u.Pos
|
||||
local Range = u.Range
|
||||
-- etc.
|
||||
```
|
||||
|
||||
This approach allows plugin authors to:
|
||||
- Pin to specific versions of u.nvim
|
||||
- Get updates by pulling/committing new **u.nvim** versions (i.e., the usual git submodule way)
|
||||
- Keep the dependency explicit and version-controlled
|
||||
- Avoid namespace conflicts with user-installed plugins
|
||||
|
||||
</details>
|
||||
|
||||
#### If you are a User
|
||||
|
||||
If you want to use u.nvim in your config directly:
|
||||
|
||||
<details>
|
||||
<summary>vim.pack</summary>
|
||||
|
||||
```lua
|
||||
vim.pack.add { 'https://github.com/jrop/u.nvim' }
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>lazy.nvim</summary>
|
||||
|
||||
```lua
|
||||
{
|
||||
'jrop/u.nvim',
|
||||
lazy = true,
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
## Signal and Rendering Usage
|
||||
|
||||
### Overview
|
||||
|
||||
Reference in New Issue
Block a user