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:18 in <nixvim>.
lib.nixvim.utils.enableExceptInTests
Usually true, except within the build.test option, 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:30 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:38 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:71 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:94 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:102 in <nixvim>.