Merge branch 'main' into feature/listof-str-border

This commit is contained in:
raf 2024-07-20 08:33:39 +00:00 committed by GitHub
commit d88b1129e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
86 changed files with 453 additions and 473 deletions

View file

@ -8,10 +8,10 @@
# - the addition of the function `entryBefore` indicating a "wanted
# by" relationship.
{lib}: let
inherit (builtins) isAttrs attrValues attrNames elem all head tail length;
inherit (builtins) isAttrs attrValues attrNames elem all head tail length toJSON isString;
inherit (lib.attrsets) filterAttrs mapAttrs;
inherit (lib.lists) toposort;
inherit (lib.nvim.dag) empty isEntry entryBetween entryAfter entriesBetween;
inherit (lib.nvim.dag) empty isEntry entryBetween entryAfter entriesBetween entryAnywhere topoSort;
in {
empty = {};
@ -147,8 +147,22 @@ in {
${section.data}
'';
mkVimrcSection = section: ''
" SECTION: ${section.name}
${section.data}
'';
resolveDag = {
name,
dag,
mapResult,
}: let
# When the value is a string, default it to dag.entryAnywhere
finalDag = mapAttrs (_: value:
if isString value
then entryAnywhere value
else value)
dag;
sortedDag = topoSort finalDag;
result =
if sortedDag ? result
then mapResult sortedDag.result
else abort ("Dependency cycle in ${name}: " + toJSON sortedDag);
in
result;
}

View file

@ -11,6 +11,5 @@
languages = import ./languages.nix {inherit lib;};
lists = import ./lists.nix {inherit lib;};
lua = import ./lua.nix {inherit lib;};
vim = import ./vim.nix;
neovimConfiguration = import ./configuration.nix {inherit inputs lib;};
}

View file

@ -5,16 +5,6 @@
inherit (lib.strings) concatStringsSep concatMapStringsSep stringToCharacters concatLines;
inherit (lib.trivial) boolToString warn;
in rec {
wrapLuaConfig = {
luaBefore ? "",
luaConfig,
luaAfter ? "",
}: ''
lua << EOF
${concatLines [luaBefore luaConfig luaAfter]}
EOF
'';
# Convert a null value to lua's nil
nullString = value:
if value == null

View file

@ -1,26 +0,0 @@
let
inherit (builtins) isInt isBool toJSON toString;
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 (toString val)
else
(
if (isBool val)
then (mkVimBool val)
else (toJSON val)
);
}