From d2edfcc24b8805e7e516bbb3be5d84a0b3255f85 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 31 Jul 2023 13:16:45 +0300 Subject: [PATCH] stuff --- flake.nix | 4 +--- lib/binds.nix | 6 ++++-- lib/default.nix | 4 ++++ lib/types/plugins.nix | 8 +++++--- modules/completion/nvim-cmp/nvim-cmp.nix | 2 +- modules/utility/motion/leap/config.nix | 3 ++- 6 files changed, 17 insertions(+), 10 deletions(-) diff --git a/flake.nix b/flake.nix index 0cf28ba..e45033d 100644 --- a/flake.nix +++ b/flake.nix @@ -24,9 +24,7 @@ ]; flake = { - lib = let - nixpkgsLib = import nixpkgs.lib; - in { + lib = { inherit (import ./lib/stdlib-extended.nix nixpkgs.lib inputs) nvim; inherit (import ./configuration.nix inputs) neovimConfiguration; }; diff --git a/lib/binds.nix b/lib/binds.nix index c2feb27..a27302c 100644 --- a/lib/binds.nix +++ b/lib/binds.nix @@ -1,4 +1,6 @@ -{lib}: rec { +{lib}: let + inherit (lib) types; +in rec { mkLuaBinding = key: action: desc: lib.mkIf (key != null) { "${key}" = { @@ -28,7 +30,7 @@ mkMappingOption = description: default: lib.mkOption { - type = lib.types.nullOrlib.types.str; + type = with types; nullOr str; inherit default description; }; diff --git a/lib/default.nix b/lib/default.nix index 892518d..d2b3d4a 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -9,4 +9,8 @@ nmd = import ./nmd.nix; lua = import ./lua.nix {inherit lib;}; binds = import ./binds.nix {inherit lib;}; + + imports = [ + (import ./binds.nix {inherit lib;}) + ]; } diff --git a/lib/types/plugins.nix b/lib/types/plugins.nix index cdc2409..a74b80b 100644 --- a/lib/types/plugins.nix +++ b/lib/types/plugins.nix @@ -8,15 +8,17 @@ with lib; let (n: v: nameValuePair (removePrefix prefix n) {src = v;}) (filterAttrs (n: _: hasPrefix prefix n) inputs); + rawPlugins = fromInputs inputs "plugin-"; + # Define the helper function to extract the names from the name-value pairs getNames = list: mapAttrsToList (name: _: name) list; - rawPlugins = fromInputs inputs "plugin-"; - # Map all plugin names to a list for pluginType to select from mappedPluginList = getNames rawPlugins; - finalPluginList = mappedPluginList ++ ["nvim-treesitter"]; + # Append plugins that are not in the mappedPluginList to the plugin list + + finalPluginList = mappedPluginList ++ ["nvim-treesitter" "flutter-tools-patched"]; # either a package from nixpkgs, or a plugin from inputs ( + "nvim-treesitter") pluginType = with types; diff --git a/modules/completion/nvim-cmp/nvim-cmp.nix b/modules/completion/nvim-cmp/nvim-cmp.nix index fa7041b..9b8f602 100644 --- a/modules/completion/nvim-cmp/nvim-cmp.nix +++ b/modules/completion/nvim-cmp/nvim-cmp.nix @@ -5,7 +5,7 @@ with builtins; { autocomplete = { enable = mkEnableOption "enable autocomplete" // {default = false;}; - mappings = { + mappings = with nvim.binds; { complete = mkMappingOption "Complete [nvim-cmp]" ""; confirm = mkMappingOption "Confirm [nvim-cmp]" ""; next = mkMappingOption "Next item [nvim-cmp]" ""; diff --git a/modules/utility/motion/leap/config.nix b/modules/utility/motion/leap/config.nix index 4a6c571..6ef38cd 100644 --- a/modules/utility/motion/leap/config.nix +++ b/modules/utility/motion/leap/config.nix @@ -3,7 +3,8 @@ lib, ... }: -with lib; let +with lib; +with nvim.binds; let cfg = config.vim.utility.motion.leap; in { config = mkIf cfg.enable {