nvf/lib/vim.nix

27 lines
473 B
Nix
Raw Permalink Normal View History

let
2024-03-24 00:14:39 +00:00
inherit (builtins) isInt isBool toJSON toString;
2023-11-06 09:33:38 +00:00
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)
2024-03-24 00:14:39 +00:00
then (toString val)
2023-11-06 09:33:38 +00:00
else
(
if (isBool val)
then (mkVimBool val)
else (toJSON val)
);
}