mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-07 10:51:36 +00:00
docs: 0.6 release notes; update developer documentation
This commit is contained in:
parent
ecbe60d57b
commit
534b837dab
3 changed files with 93 additions and 62 deletions
|
@ -1,13 +1,14 @@
|
|||
# Adding Plugins {#sec-additional-plugins}
|
||||
|
||||
To add a new neovim plugin, first add the source url in the inputs section of `flake.nix`
|
||||
with the prefix `plugin-`
|
||||
|
||||
```nix
|
||||
|
||||
{
|
||||
inputs = {
|
||||
# ...
|
||||
neodev-nvim = {
|
||||
plugin-neodev-nvim = {
|
||||
url = "github:folke/neodev.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
@ -16,17 +17,13 @@ To add a new neovim plugin, first add the source url in the inputs section of `f
|
|||
}
|
||||
```
|
||||
|
||||
Then add the name of the plugin into the `availablePlugins` variable in `lib/types/plugins.nix`:
|
||||
The addition of the `plugin-` prefix will allow neovim-flake to autodiscover the
|
||||
input from the flake inputs automatically, allowing you to refer to it in areas
|
||||
that require a very specific plugin type as defined in `lib/types/plugins.nix`
|
||||
|
||||
```nix
|
||||
# ...
|
||||
availablePlugins = [
|
||||
# ...
|
||||
"neodev-nvim"
|
||||
];
|
||||
```
|
||||
|
||||
You can now reference this plugin using its string name:
|
||||
You can now reference this plugin using its string name, the plugin will be
|
||||
built with the name and source URL from the flake input, allowing you to
|
||||
refer to it as a **string**.
|
||||
|
||||
```nix
|
||||
config.vim.startPlugins = ["neodev-nvim"];
|
||||
|
@ -107,19 +104,23 @@ Now users can set any of the pre-defined option field, and can also add their ow
|
|||
|
||||
## Details of toLuaObject {#sec-details-of-toluaobject}
|
||||
|
||||
As you've seen above, `toLuaObject` is used to convert our nix attrSet `cfg.setupOpts`, into a lua
|
||||
table. Here are some rules of the conversion:
|
||||
As you've seen above, `toLuaObject` is used to convert our nix attrSet
|
||||
`cfg.setupOpts`, into a lua table. Here are some rules of the conversion:
|
||||
|
||||
1. nix `null` converts to lua `nil`
|
||||
2. number and strings convert to their lua counterparts
|
||||
3. nix attrSet/list converts into lua tables
|
||||
4. you can write raw lua code using `lib.generators.mkLuaInline`. This function is part of nixpkgs.
|
||||
```nix
|
||||
vim.your-plugin.setupOpts = {
|
||||
on_init = lib.generators.mkLuaInline ''
|
||||
function()
|
||||
print('we can write lua!')
|
||||
end
|
||||
'';
|
||||
}
|
||||
```
|
||||
3. nix attrSet/list convert into lua tables
|
||||
4. you can write raw lua code using `lib.generators.mkLuaInline`. This
|
||||
function is part of nixpkgs.
|
||||
|
||||
Example:
|
||||
|
||||
```nix
|
||||
vim.your-plugin.setupOpts = {
|
||||
on_init = lib.generators.mkLuaInline ''
|
||||
function()
|
||||
print('we can write lua!')
|
||||
end
|
||||
'';
|
||||
}
|
||||
```
|
||||
|
|
|
@ -7,12 +7,16 @@ To use it, we first add the input flake.
|
|||
|
||||
```nix
|
||||
{
|
||||
neovim-flake = {
|
||||
url = github:notashelf/neovim-flake;
|
||||
# you can override input nixpkgs
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
# you can also override individual plugins
|
||||
# i.e inputs.obsidian-nvim.follows = "obsidian-nvim"; # <- obsidian nvim needs to be in your inputs
|
||||
inputs = {
|
||||
obsidian-nvim.url = "github:epwalsh/obsidian.nvim";
|
||||
neovim-flake = {
|
||||
url = "github:notashelf/neovim-flake";
|
||||
# you can override input nixpkgs
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
# you can also override individual plugins
|
||||
# for example:
|
||||
inputs.obsidian-nvim.follows = "obsidian-nvim"; # <- this will use the obsidian-nvim from your inputs
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
@ -26,14 +30,15 @@ Followed by importing the home-manager module somewhere in your configuration.
|
|||
}
|
||||
```
|
||||
|
||||
An example installation for standalone home-manager would look like this:
|
||||
An example installation for neovim-flake under standalone home-manager
|
||||
would look like this:
|
||||
|
||||
```nix
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
home-manager.url = "github:nix-community/home-manager";
|
||||
stylix.url = "github:notashelf/neovim-flake";
|
||||
neovim-flake.url = "github:notashelf/neovim-flake";
|
||||
};
|
||||
|
||||
outputs = { nixpkgs, home-manager, neovim-flake ... }: let
|
||||
|
@ -55,7 +60,6 @@ home-manager configuration.
|
|||
|
||||
```nix{
|
||||
programs.neovim-flake = {
|
||||
|
||||
enable = true;
|
||||
# your settings need to go into the settings attribute set
|
||||
# most settings are documented in the appendix
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue