neovim-flake/lib/vim.nix

27 lines
473 B
Nix
Raw Normal View History

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