mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-12-16 09:01:03 +00:00
wrapper/rc: add vim.options
Translates an attribute set of values into `vim.o` values in a key-value format.
This commit is contained in:
parent
c957b23aaa
commit
5d8fc297b6
2 changed files with 31 additions and 4 deletions
|
|
@ -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;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
:::
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue