mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-11-05 05:02:20 +00:00
Merge branch 'main' into feature/listof-str-border
This commit is contained in:
commit
d88b1129e5
86 changed files with 453 additions and 473 deletions
26
lib/dag.nix
26
lib/dag.nix
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;};
|
||||
}
|
||||
|
|
|
|||
10
lib/lua.nix
10
lib/lua.nix
|
|
@ -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
|
||||
|
|
|
|||
26
lib/vim.nix
26
lib/vim.nix
|
|
@ -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)
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue