Plugins now accept a "type" element describing the language (viml, lua
, teal, fennel, ...) in which
they are configured.
The configuration of the different plugins is aggregated per language
and made available as a key in the attribute set `programs.neovim.generatedConfigs`
For instance if you want to configure a lua package:
```
programs.neovim.plugins = [
{
plugin = packer-nvim;
type = "lua";
config = ''
require('packer').init({
luarocks = {
python_cmd = 'python' -- Set the python command to use for running hererocks
},
})
'';
}
]
```
and you can save the generated lua config to a file via
```
xdg.configFile = {
"nvim/init.generated.lua".text = config.programs.neovim.generatedConfigs.lua;
};
```
Expose the generated viml config, this has 2 advantages:
1/ user can choose to write the generated config to a file of its choice
2/ the user can prepend/append to the config before writing it
xdg.configFile."nvim/init.vim".text = ''
" prepend some config
${programs.neovim.generatedConfigViml}
" append some config
'';
NOTE: this was already possible with
xdg.configFile."nvim/init.vim" = mkMerge [
(mkBefore {
text = ''
" prepend some config
'';
})
(mkAfter {
text = ''
" append some config
'';
})
]
This adds two new options: 'programs.neovim.coc.{enable,settings}`.
These settings offer a simple interface over `xdg.configFile."nvim/coc-settings.json`,
using the standard Nix' syntax instead of a multiline string.
When installing plugins, Home Manager expects plugins (packages) to have
a `pname` attribute.
This is not always the case, so fallback to `name` if `pname` is unset.
The `configure` option is not type checked and an artifact of how
nixpkgs is implemented.
We now have the equivalent options in home-manager and managing
interactions between the 2 systems complexifies maintainance of the
module.
Please use the other options at your disposal:
configure.packages.*.opt -> programs.neovim.plugins = [ { plugin = ...; optional = true; }]
configure.packages.*.start -> programs.neovim.plugins = [ { plugin = ...; }]
configure.customRC -> programs.neovim.extraConfig
* neovim: write config in $XDG_CONFIG_HOME/init.vim
instead of wrapping the configuration, which has sideeffects
https://github.com/NixOS/nixpkgs/issues/55376
* fix: update test accordingly
* neovim: allow setting init.vim config alongside plugins
* neovim: add test for neovim plugins
* neovim: make pluginWithConfigType a have type submodule
The `programs.neovim.configure` option is consistent with NixOS's
`wrapNeovim` and offers features not supported by the `extraConfig`
and `plugins` option pair.
Closes#971