mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-02-24 04:18:03 +00:00
Compare commits
1 commit
9fa922b1c6
...
2a47a4fdaf
Author | SHA1 | Date | |
---|---|---|---|
![]() |
2a47a4fdaf |
3 changed files with 16 additions and 45 deletions
|
@ -5,19 +5,16 @@ can add code that relies on other code. However, if you don't know what the
|
||||||
entries are called, it's hard to do that, so here is a list of the internal
|
entries are called, it's hard to do that, so here is a list of the internal
|
||||||
entries in nvf:
|
entries in nvf:
|
||||||
|
|
||||||
## `vim.luaConfigRC` (top-level DAG) {#ch-vim-luaconfigrc}
|
`vim.luaConfigRC` (top-level DAG):
|
||||||
|
|
||||||
1. (`luaConfigPre`) - not a part of the actual DAG, instead, it's simply
|
1. (`luaConfigPre`) - not a part of the actual DAG, instead, it's simply
|
||||||
inserted before the rest of the DAG
|
inserted before the rest of the DAG
|
||||||
2. `globalsScript` - used to set globals defined in `vim.globals`
|
2. `globalsScript` - used to set globals defined in `vim.globals`
|
||||||
3. `basic` - used to set basic configuration options
|
3. `basic` - used to set basic configuration options
|
||||||
4. `optionsScript` - used to set options defined in `vim.o`
|
4. `theme` (this is simply placed before `pluginConfigs`, meaning that surrounding entries don't depend on it) - used to set up the theme, which has to be done before other plugins
|
||||||
5. `theme` (this is simply placed before `pluginConfigs`, meaning that
|
5. `pluginConfigs` - the result of the nested `vim.pluginRC` (internal option,
|
||||||
surrounding entries don't depend on it) - used to set up the theme, which has
|
see the [Custom Plugins](/index.xhtml#ch-custom-plugins) page for adding your own
|
||||||
to be done before other plugins
|
plugins) DAG, used to set up internal plugins
|
||||||
6. `pluginConfigs` - the result of the nested `vim.pluginRC` (internal option,
|
6. `extraPluginConfigs` - the result of `vim.extraPlugins`, which is not a
|
||||||
see the [Custom Plugins](/index.xhtml#ch-custom-plugins) page for adding your
|
|
||||||
own plugins) DAG, used to set up internal plugins
|
|
||||||
7. `extraPluginConfigs` - the result of `vim.extraPlugins`, which is not a
|
|
||||||
direct DAG, but is converted to, and resolved as one internally
|
direct DAG, but is converted to, and resolved as one internally
|
||||||
8. `mappings` - the result of `vim.maps`
|
7. `mappings` - the result of `vim.maps`
|
||||||
|
|
|
@ -80,11 +80,10 @@
|
||||||
maps);
|
maps);
|
||||||
in {
|
in {
|
||||||
config = let
|
config = let
|
||||||
|
filterNonNull = attrs: filterAttrs (_: value: value != null) attrs;
|
||||||
globalsScript =
|
globalsScript =
|
||||||
mapAttrsToList (name: value: "vim.g.${name} = ${toLuaObject value}") cfg.globals;
|
mapAttrsToList (name: value: "vim.g.${name} = ${toLuaObject value}")
|
||||||
|
(filterNonNull cfg.globals);
|
||||||
optionsScript =
|
|
||||||
mapAttrsToList (name: value: "vim.o.${name} = ${toLuaObject value}") cfg.options;
|
|
||||||
|
|
||||||
extraPluginConfigs = resolveDag {
|
extraPluginConfigs = resolveDag {
|
||||||
name = "extra plugin configs";
|
name = "extra plugin configs";
|
||||||
|
@ -133,12 +132,9 @@ in {
|
||||||
in {
|
in {
|
||||||
vim = {
|
vim = {
|
||||||
luaConfigRC = {
|
luaConfigRC = {
|
||||||
# `vim.g` and `vim.o`
|
|
||||||
globalsScript = entryAnywhere (concatLines globalsScript);
|
globalsScript = entryAnywhere (concatLines globalsScript);
|
||||||
optionsScript = entryAfter ["basic"] (concatLines optionsScript);
|
# basic
|
||||||
|
pluginConfigs = entryAfter ["basic"] pluginConfigs;
|
||||||
# Basic
|
|
||||||
pluginConfigs = entryAfter ["optionsScript"] pluginConfigs;
|
|
||||||
extraPluginConfigs = entryAfter ["pluginConfigs"] extraPluginConfigs;
|
extraPluginConfigs = entryAfter ["pluginConfigs"] extraPluginConfigs;
|
||||||
mappings = entryAfter ["extraPluginConfigs"] mappings;
|
mappings = entryAfter ["extraPluginConfigs"] mappings;
|
||||||
};
|
};
|
||||||
|
|
|
@ -129,38 +129,16 @@ in {
|
||||||
globals = mkOption {
|
globals = mkOption {
|
||||||
type = attrs;
|
type = attrs;
|
||||||
default = {};
|
default = {};
|
||||||
example = {"some_variable" = 42;};
|
|
||||||
description = ''
|
description = ''
|
||||||
An attribute set containing global variable values
|
An attribute set containing global variable values
|
||||||
for storing vim variables as early as possible. If
|
for storing vim variables as early as possible. If
|
||||||
populated, this option will set vim variables in the
|
populated, this option will set vim variables in the
|
||||||
built luaConfigRC as the first item.
|
built luaConfigRC as the first item.
|
||||||
|
|
||||||
::: {.note}
|
E.g. {foo = "bar"} will set `vim.g.foo` to "bar" where
|
||||||
`{foo = "bar";}` will set `vim.g.foo` to "bar", where
|
the type of `bar` in the resulting vimscript will be
|
||||||
the type of `bar` in the resulting Lua value will be
|
infered from the type of the value in the `{name = value}`
|
||||||
inferred from the type of the value in the `{name = value;}`
|
pair.
|
||||||
pair passed to the option.
|
|
||||||
:::
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
options = mkOption {
|
|
||||||
type = attrs;
|
|
||||||
default = {};
|
|
||||||
example = {visualbell = true;};
|
|
||||||
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
|
|
||||||
inferred from the type of the value in the`{name = value;}`
|
|
||||||
pair passed to the option.
|
|
||||||
:::
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue