mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-12-19 02:11:20 +00:00
Revert "lib/binds: improve code, adjust functions to new api"
This reverts commit 6cb57e1d26.
This commit is contained in:
parent
316c24c948
commit
3d79f13830
1 changed files with 61 additions and 60 deletions
|
|
@ -4,29 +4,30 @@
|
||||||
inherit (lib.types) nullOr str;
|
inherit (lib.types) nullOr str;
|
||||||
inherit (lib.attrsets) isAttrs mapAttrs;
|
inherit (lib.attrsets) isAttrs mapAttrs;
|
||||||
|
|
||||||
mkLuaBinding = mode: key: action: desc:
|
binds = rec {
|
||||||
|
mkLuaBinding = key: action: desc:
|
||||||
mkIf (key != null) {
|
mkIf (key != null) {
|
||||||
${key} = {
|
"${key}" = {
|
||||||
inherit mode action desc;
|
inherit action desc;
|
||||||
lua = true;
|
lua = true;
|
||||||
silent = true;
|
silent = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
mkExprBinding = mode: key: action: desc:
|
mkExprBinding = key: action: desc:
|
||||||
mkIf (key != null) {
|
mkIf (key != null) {
|
||||||
${key} = {
|
"${key}" = {
|
||||||
inherit mode action desc;
|
inherit action desc;
|
||||||
lua = true;
|
lua = true;
|
||||||
silent = true;
|
silent = true;
|
||||||
expr = true;
|
expr = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
mkBinding = mode: key: action: desc:
|
mkBinding = key: action: desc:
|
||||||
mkIf (key != null) {
|
mkIf (key != null) {
|
||||||
${key} = {
|
"${key}" = {
|
||||||
inherit mode action desc;
|
inherit action desc;
|
||||||
silent = true;
|
silent = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -47,25 +48,25 @@
|
||||||
isNested = isAttrs value;
|
isNested = isAttrs value;
|
||||||
returnedValue =
|
returnedValue =
|
||||||
if isNested
|
if isNested
|
||||||
then addDescriptionsToMappings actualMappings.${name} mappingDefinitions.${name}
|
then addDescriptionsToMappings actualMappings."${name}" mappingDefinitions."${name}"
|
||||||
else {
|
else {
|
||||||
inherit value;
|
inherit value;
|
||||||
inherit (mappingDefinitions.${name}) description;
|
inherit (mappingDefinitions."${name}") description;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
returnedValue)
|
returnedValue)
|
||||||
actualMappings;
|
actualMappings;
|
||||||
|
|
||||||
mkSetBinding = mode: binding: action:
|
mkSetBinding = binding: action:
|
||||||
mkBinding mode binding.value action binding.description;
|
mkBinding binding.value action binding.description;
|
||||||
|
|
||||||
mkSetExprBinding = mode: binding: action:
|
mkSetExprBinding = binding: action:
|
||||||
mkExprBinding mode binding.value action binding.description;
|
mkExprBinding binding.value action binding.description;
|
||||||
|
|
||||||
mkSetLuaBinding = mode: binding: action:
|
mkSetLuaBinding = binding: action:
|
||||||
mkLuaBinding mode binding.value action binding.description;
|
mkLuaBinding binding.value action binding.description;
|
||||||
|
|
||||||
pushDownDefault = attr: mapAttrs (_: mkDefault) attr;
|
pushDownDefault = attr: mapAttrs (_: mkDefault) attr;
|
||||||
in {
|
};
|
||||||
inherit mkLuaBinding mkExprBinding mkBinding mkMappingOption addDescriptionsToMappings mkSetBinding mkSetExprBinding mkSetLuaBinding pushDownDefault;
|
in
|
||||||
}
|
binds
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue