lib: move global functions to extended lib

This commit is contained in:
NotAShelf 2024-04-08 01:36:59 +03:00
parent a12ba5689a
commit 51e28d415a
No known key found for this signature in database
GPG key ID: 02D1DD3FA08B6B29
4 changed files with 18 additions and 12 deletions

View file

@ -66,8 +66,7 @@
mkSetLuaBinding = binding: action:
mkLuaBinding binding.value action binding.description;
pushDownDefault = attr: mapAttrs (_name: value: mkDefault value) attr;
# pushDownDefault = attr: self.mapAttrs (name: value: self.mkDefault value) attr;
pushDownDefault = attr: mapAttrs (_: value: mkDefault value) attr;
};
in
binds

11
lib/config.nix Normal file
View file

@ -0,0 +1,11 @@
{lib}: let
inherit (lib.options) mkOption;
inherit (lib.types) bool;
in {
mkBool = value: description:
mkOption {
type = bool;
default = value;
inherit description;
};
}

View file

@ -1,5 +1,7 @@
{lib}: {
types = import ./types {inherit lib;};
config = import ./config.nix {inherit lib;};
binds = import ./binds.nix {inherit lib;};
dag = import ./dag.nix {inherit lib;};
languages = import ./languages.nix {inherit lib;};

View file

@ -3,10 +3,10 @@
lib,
...
}: let
inherit (builtins) attrValues attrNames map mapAttrs toJSON isString concatStringsSep filter;
inherit (builtins) map mapAttrs toJSON filter;
inherit (lib.options) mkOption;
inherit (lib.attrsets) filterAttrs getAttrs;
inherit (lib.strings) optionalString;
inherit (lib.attrsets) filterAttrs getAttrs attrValues attrNames;
inherit (lib.strings) optionalString isString concatStringsSep;
inherit (lib.misc) mapAttrsFlatten;
inherit (lib.trivial) showWarnings;
inherit (lib.types) bool str oneOf attrsOf nullOr attrs submodule lines;
@ -15,6 +15,7 @@
inherit (lib.generators) mkLuaInline;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.vim) valToVim;
inherit (lib.nvim.config) mkBool;
cfg = config.vim;
@ -27,13 +28,6 @@
EOF
'';
mkBool = value: description:
mkOption {
type = bool;
default = value;
inherit description;
};
# Most of the keybindings code is highly inspired by pta2002/nixvim. Thank you!
mapConfigOptions = {
silent =