lib/neovim-plugin: Add lua configuration scoped to the plugin

This commit adds a `plugins.<name>.luaConfig` section controlling the
plugin specific configuration.

The section contains the internal `init` option, containing the plugin's
initialization code.

It also contains the public `pre` and `post` options, that allow to add
code before & after the `init` section

Finally, it contains the `final` option, being the concatenation of the
three previous options.
This commit is contained in:
Quentin Boyer 2024-08-19 23:31:57 +02:00 committed by nix-infra-bot
parent 2bc6a94992
commit d2f9e011d9
21 changed files with 129 additions and 35 deletions

View file

@ -39,7 +39,7 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
};
extraConfig = cfg: {
extraConfigLuaPre = ''
colorschemes.ayu.luaConfig.content = ''
local ayu = require("ayu")
ayu.setup(${toLuaObject cfg.settings})
ayu.colorscheme()

View file

@ -179,7 +179,7 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
# `settings` can either be passed to `with_config` before calling `setup`,
# or it can be passed as `setup`'s 2nd argument.
# See https://github.com/RRethy/base16-nvim/blob/6ac181b5733518040a33017dde654059cd771b7c/lua/base16-colorscheme.lua#L107-L125
extraConfigLuaPre = ''
colorschemes.base16.luaConfig.content = ''
do
local base16 = require('${luaName}')
base16.with_config(${toLuaObject cfg.settings})

View file

@ -34,7 +34,7 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
callSetup = false;
colorscheme = null;
extraConfig = cfg: {
extraConfigLuaPre = ''
colorschemes.onedark.luaConfig.content = ''
_onedark = require('onedark')
_onedark.setup(${lib.nixvim.toLuaObject cfg.settings})
_onedark.load()

View file

@ -31,7 +31,7 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
};
extraConfig = cfg: {
extraConfigLuaPre = ''
colorschemes.vscode.luaConfig.content = ''
local _vscode = require("vscode")
_vscode.setup(${toLuaObject cfg.settings})
_vscode.load()