diff --git a/lib/helpers.nix b/lib/helpers.nix index 7ef8b802..ecc709a3 100644 --- a/lib/helpers.nix +++ b/lib/helpers.nix @@ -49,42 +49,6 @@ with lib; rec { emptyTable = {"__empty" = null;}; - # Generates maps for a lua config - genMaps = mode: maps: let - normalized = - builtins.mapAttrs - (key: action: - if builtins.isString action - then { - silent = false; - expr = false; - unique = false; - noremap = true; - remap = false; - script = false; - nowait = false; - action = action; - } - else { - inherit (action) silent expr unique noremap script nowait remap; - action = - if action.lua - then mkRaw action.action - else action.action; - }) - maps; - in - builtins.attrValues (builtins.mapAttrs - (key: action: { - action = action.action; - config = lib.filterAttrs (_: v: v) { - inherit (action) silent expr unique noremap script nowait remap; - }; - key = key; - mode = mode; - }) - normalized); - # Given an attrs of key mappings (for a single mode), applies the defaults to each one of them. # # Example: diff --git a/modules/keymaps.nix b/modules/keymaps.nix index e9f584e4..2407da2d 100644 --- a/modules/keymaps.nix +++ b/modules/keymaps.nix @@ -6,70 +6,119 @@ with lib; let helpers = import ../lib/helpers.nix {inherit lib;}; + # These are the configuration options that change the behavior of each mapping. + mapConfigOptions = { + silent = + helpers.defaultNullOpts.mkBool false + "Whether this mapping should be silent. Equivalent to adding to a map."; + + nowait = + helpers.defaultNullOpts.mkBool false + "Whether to wait for extra input on ambiguous mappings. Equivalent to adding to a map."; + + script = + helpers.defaultNullOpts.mkBool false + "Equivalent to adding