lib.nixvim.utils: utility functions
lib.nixvim.utils.listToUnkeyedAttrs
Transforms a list to an "unkeyed" attribute set.
This allows to define mixed table/list in lua:
listToUnkeyedAttrs ["a" "b"] // { foo = "bar"; }
Resulting in the following lua:
{"a", "b", foo = "bar"}
Located at lib/utils.nix:21 in <nixvim>
.
lib.nixvim.utils.enableExceptInTests
Usually true
, except when nixvim is being evaluated by
mkTestDerivationFromNixvimModule
, where it is false
.
This can be used to dynamically enable plugins that can't be run in the test environment.
Located at lib/utils.nix:34 in <nixvim>
.
lib.nixvim.utils.emptyTable
An empty lua table { }
that will be included in the final lua configuration.
This is equivalent to { __empty = { }; }
.
This form can allow to do option.__empty = { }
.
Located at lib/utils.nix:42 in <nixvim>
.
lib.nixvim.utils.toRawKeys
Convert the keys of the given attrset to "raw lua".
Example
toRawKeys { foo = 1; bar = 2; }
=> { __rawKey__foo = 1; __rawKey__bar = 2; }
Resulting in the following lua:
{[foo] = 1, [bar] = 2}
If "raw keys" are not used, the attr names are treated as string keys:
{foo = 1, bar = 2}
Type
toRawKeys :: AttrSet -> AttrSet
Located at lib/utils.nix:75 in <nixvim>
.
lib.nixvim.utils.mkRawKey
Create a 1-element attrs with a raw lua key.
Example
mkRawKey "foo" 1
=> { __rawKey__foo = 1; }
Type
mkRawKey :: String -> String -> AttrSet
Arguments
- [n] The attribute name (raw lua)
- [v] The attribute value
Located at lib/utils.nix:98 in <nixvim>
.
lib.nixvim.utils.mkRaw
Write the string str
as raw lua in the final lua configuration.
This is equivalent to { __raw = "lua code"; }
.
This form can allow to do option.__raw = "lua code"
.
Located at lib/utils.nix:106 in <nixvim>
.