mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-26 23:16:46 +00:00
27 lines
480 B
Nix
27 lines
480 B
Nix
|
{lib}: let
|
||
|
inherit (builtins) isInt isBool toJSON;
|
||
|
in rec {
|
||
|
# yes? no.
|
||
|
yesNo = value:
|
||
|
if value
|
||
|
then "yes"
|
||
|
else "no";
|
||
|
|
||
|
# convert a boolean to a vim compliant boolean string
|
||
|
mkVimBool = val:
|
||
|
if val
|
||
|
then "1"
|
||
|
else "0";
|
||
|
|
||
|
# convert a literal value to a vim compliant value
|
||
|
valToVim = val:
|
||
|
if (isInt val)
|
||
|
then (builtins.toString val)
|
||
|
else
|
||
|
(
|
||
|
if (isBool val)
|
||
|
then (mkVimBool val)
|
||
|
else (toJSON val)
|
||
|
);
|
||
|
}
|