nvf/docs/manual/configuring/custom-plugins/configuring.md
diniamo f9789432f9
treewide: make the entire generated config lua based (#333)
* modules: switch to gerg's neovim-wrapper

* modules: use initViml instead of writing the file

* treewide: make the entire generated config lua based

* docs: remove mentions of configRC

* plugins/treesitter: remove vim.cmd hack

* treewide: move resolveDag to lib

* modules/wrapper(rc): fix typo

* treewide: migrate to pluginRC for correct DAG order

The "new" DAG order is as follows:
- (luaConfigPre)
- globalsScript
- basic
- theme
- pluginConfigs
- extraPluginConfigs
- mappings
- (luaConfigPost)

* plugins/theme: fix theme DAG place

* plugins/theme: fix fixed theme DAG place

* modules/wrapper(rc): add removed option module for configRC

* docs: add dag-entries chapter, add release note entry

* fix: formatting CI

* languages/nix: add missing `local`

* docs: fix page link

* docs: add mention of breaking changes at the start of the release notes

* plugins/neo-tree: convert to pluginRC

* modules/wrapper(rc): add back entryAnywhere

* modules/wrapper(rc): expose pluginRC

* apply raf patch

---------

Co-authored-by: NotAShelf <raf@notashelf.dev>
2024-07-20 08:30:48 +00:00

49 lines
1.8 KiB
Markdown

# Configuring {#sec-configuring-plugins}
Just making the plugin to your Neovim configuration available might not always
be enough. In that case, you can write custom lua config using either
`config.vim.extraPlugins` (which has the `setup` field) or
`config.vim.luaConfigRC`. The first option uses an attribute set, which maps DAG
section names to a custom type, which has the fields `package`, `after`,
`setup`. They allow you to set the package of the plugin, the sections its setup
code should be after (note that the `extraPlugins` option has its own DAG
scope), and the its setup code respectively. For example:
```nix
config.vim.extraPlugins = with pkgs.vimPlugins; {
aerial = {
package = aerial-nvim;
setup = "require('aerial').setup {}";
};
harpoon = {
package = harpoon;
setup = "require('harpoon').setup {}";
after = ["aerial"]; # place harpoon configuration after aerial
};
}
```
The second option also uses an attribute set, but this one is resolved as a DAG
directly. The attribute names denote the section names, and the values lua code.
For example:
```nix
{
# this will create an "aquarium" section in your init.lua with the contents of your custom config
# which will be *appended* to the rest of your configuration, inside your init.vim
config.vim.luaConfigRC.aquarium = "vim.cmd('colorscheme aquiarum')";
}
```
:::{.note}
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
https://github.com/nix-community/home-manager/blob/master/modules/lib/dag.nix
to find out more about the DAG system.
:::
If you successfully made your plugin work, please feel free to create a PR to
add it to **nvf** or open an issue with your findings so that we can make it
available for everyone easily.