diff --git a/modules/wrapper/rc/config.nix b/modules/wrapper/rc/config.nix index 8ebf1c2c..417077a6 100644 --- a/modules/wrapper/rc/config.nix +++ b/modules/wrapper/rc/config.nix @@ -85,6 +85,10 @@ in { mapAttrsToList (name: value: "vim.g.${name} = ${toLuaObject value}") (filterNonNull cfg.globals); + optionsScript = + mapAttrsToList (name: value: "vim.o.${name} = ${toLuaObject value}") + (filterNonNull cfg.options); + extraPluginConfigs = resolveDag { name = "extra plugin configs"; dag = mapAttrs (_: value: entryAfter value.after value.setup) cfg.extraPlugins; @@ -132,9 +136,12 @@ in { in { vim = { luaConfigRC = { + # `vim.g` and `vim.o` globalsScript = entryAnywhere (concatLines globalsScript); - # basic - pluginConfigs = entryAfter ["basic"] pluginConfigs; + optionsScript = entryAfter ["basic"] (concatLines optionsScript); + + # Basic + pluginConfigs = entryAfter ["optionsScript"] pluginConfigs; extraPluginConfigs = entryAfter ["pluginConfigs"] extraPluginConfigs; mappings = entryAfter ["extraPluginConfigs"] mappings; }; diff --git a/modules/wrapper/rc/options.nix b/modules/wrapper/rc/options.nix index 4165da6d..0cc6fca3 100644 --- a/modules/wrapper/rc/options.nix +++ b/modules/wrapper/rc/options.nix @@ -135,10 +135,30 @@ in { populated, this option will set vim variables in the built luaConfigRC as the first item. - E.g. {foo = "bar"} will set `vim.g.foo` to "bar" where - the type of `bar` in the resulting vimscript will be + ::: {.note} + `{foo = "bar";}` will set `vim.g.foo` to "bar" where + the type of `bar` in the resulting Lua value will be + infered from the type of the value in the `{name = value;}` + pair. + ::: + ''; + }; + + options = mkOption { + type = attrs; + default = {}; + description = '' + An attribute set containing vim options to be set + as early as possible. If populated, this option will + set vim options in the built luaConfigRC after `basic` + and before `pluginConfigs` DAG entries. + + ::: {.note} + `{foo = "bar"}` will set `vim.o.foo` to "bar" where + the type of `bar` in the resulting Lua value will be infered from the type of the value in the `{name = value}` pair. + ::: ''; };