docs/custom-plugins: improve wording for DAG; link to local docs

This commit is contained in:
raf 2024-11-07 10:58:40 +03:00
parent a2b9e645eb
commit 4435754702
Signed by: NotAShelf
GPG key ID: AF26552424E53993

View file

@ -1,12 +1,13 @@
# Configuring {#sec-configuring-plugins} # Configuring {#sec-configuring-plugins}
Just making the plugin to your Neovim configuration available might not always be enough. In that Just making the plugin to your Neovim configuration available might not always
case, you can write custom lua config using either `config.vim.lazy.plugins.*.setupOpts` be enough. In that case, you can write custom lua config using either
`config.vim.extraPlugins.*.setup` or `config.vim.luaConfigRC`. `config.vim.lazy.plugins.*.setupOpts` `config.vim.extraPlugins.*.setup` or
`config.vim.luaConfigRC`.
The first option uses an extended version of `lz.n`'s PluginSpec. `setupModule` and `setupOpt` can The first option uses an extended version of `lz.n`'s PluginSpec. `setupModule`
be used if the plugin uses a `require('module').setup(...)` pattern. Otherwise, the `before` and and `setupOpt` can be used if the plugin uses a `require('module').setup(...)`
`after` hooks should do what you need. pattern. Otherwise, the `before` and `after` hooks should do what you need.
```nix ```nix
{ {
@ -24,10 +25,11 @@ be used if the plugin uses a `require('module').setup(...)` pattern. Otherwise,
} }
``` ```
The second option uses an attribute set, which maps DAG section names to a custom type, which has The second option uses an attribute set, which maps DAG section names to a
the fields `package`, `after`, `setup`. They allow you to set the package of the plugin, the custom type, which has the fields `package`, `after`, `setup`. They allow you to
sections its setup code should be after (note that the `extraPlugins` option has its own DAG set the package of the plugin, the sections its setup code should be after (note
scope), and the its setup code respectively. For example: that the `extraPlugins` option has its own DAG scope), and the its setup code
respectively. For example:
```nix ```nix
config.vim.extraPlugins = with pkgs.vimPlugins; { config.vim.extraPlugins = with pkgs.vimPlugins; {
@ -56,13 +58,17 @@ For example:
} }
``` ```
:::{.note} <!-- deno-fmt-ignore-start -->
If your configuration needs to be put in a specific place in the config, you
can use functions from `inputs.nvf.lib.nvim.dag` to order it. Refer to ::: {.note}
https://github.com/nix-community/home-manager/blob/master/modules/lib/dag.nix One of the greatest strengths of nvf is the ability to order
snippets of configuration via the DAG system. It will allow specifying positions
of individual sections of configuration as needed. nvf provides helper functions
in the extended library, usually under `inputs.nvf.lib.nvim.dag` that you may
use.
Please refer to the [DAG section](/index.xhtml#ch-dag-entries) in the nvf manual
to find out more about the DAG system. to find out more about the DAG system.
::: :::
If you successfully made your plugin work, please feel free to create a PR to <!-- deno-fmt-ignore-end -->
add it to **nvf** or open an issue with your findings so that we can make it
available for everyone easily.