diff --git a/lib/keymap-helpers.nix b/lib/keymap-helpers.nix index 10567db1..8f9f2a62 100644 --- a/lib/keymap-helpers.nix +++ b/lib/keymap-helpers.nix @@ -1,7 +1,7 @@ { lib }: let inherit (lib) optionalAttrs isAttrs types; - inherit (lib.nixvim) defaultNullOpts mkNullOrStr; + inherit (lib.nixvim) defaultNullOpts mkNullOrOption mkNullOrStr; in rec { # These are the configuration options that change the behavior of each mapping. @@ -23,6 +23,12 @@ rec { desc = mkNullOrStr "A textual description of this keybind, to be shown in which-key, if you have it."; buffer = defaultNullOpts.mkBool false "Make the mapping buffer-local. Equivalent to adding `` to a map."; + + replace_keycodes = mkNullOrOption types.bool '' + When `expr` is `true`, replace keycodes in the resulting string. + + Returning `nil` from the Lua `callback` is equivalent to returning an empty string. + ''; }; modes = [ diff --git a/tests/test-sources/modules/keymaps.nix b/tests/test-sources/modules/keymaps.nix index 1a670504..09ecfa4e 100644 --- a/tests/test-sources/modules/keymaps.nix +++ b/tests/test-sources/modules/keymaps.nix @@ -48,6 +48,12 @@ key = ""; action = "bar"; } + { + mode = "n"; + key = ""; + action.__raw = "function() end"; + options.replace_keycodes = false; + } ]; };