kakoune: support user modes in keyMappings
kakoune: support user modes in keyMappings User modes are declared automatically. PR #1286
This commit is contained in:
parent
8736190743
commit
7dc322c1eb
|
@ -97,16 +97,7 @@ let
|
||||||
keyMapping = types.submodule {
|
keyMapping = types.submodule {
|
||||||
options = {
|
options = {
|
||||||
mode = mkOption {
|
mode = mkOption {
|
||||||
type = types.enum [
|
type = types.str;
|
||||||
"insert"
|
|
||||||
"normal"
|
|
||||||
"prompt"
|
|
||||||
"menu"
|
|
||||||
"user"
|
|
||||||
"goto"
|
|
||||||
"view"
|
|
||||||
"object"
|
|
||||||
];
|
|
||||||
example = "user";
|
example = "user";
|
||||||
description = ''
|
description = ''
|
||||||
The mode in which the mapping takes effect.
|
The mode in which the mapping takes effect.
|
||||||
|
@ -543,6 +534,21 @@ let
|
||||||
}"
|
}"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
userModeString = mode:
|
||||||
|
optionalString (!builtins.elem mode [
|
||||||
|
"insert"
|
||||||
|
"normal"
|
||||||
|
"prompt"
|
||||||
|
"menu"
|
||||||
|
"user"
|
||||||
|
"goto"
|
||||||
|
"view"
|
||||||
|
"object"
|
||||||
|
]) "try %{declare-user-mode ${mode}}";
|
||||||
|
|
||||||
|
userModeStrings = map userModeString
|
||||||
|
(lists.unique (map (km: km.mode) cfg.config.keyMappings));
|
||||||
|
|
||||||
keyMappingString = km:
|
keyMappingString = km:
|
||||||
concatStringsSep " " [
|
concatStringsSep " " [
|
||||||
"map global"
|
"map global"
|
||||||
|
@ -592,7 +598,8 @@ let
|
||||||
++ [ "# UI options" ]
|
++ [ "# UI options" ]
|
||||||
++ optional (ui != null) "set-option global ui_options ${uiOptions}"
|
++ optional (ui != null) "set-option global ui_options ${uiOptions}"
|
||||||
|
|
||||||
++ [ "# Key mappings" ] ++ map keyMappingString keyMappings
|
++ [ "# User modes" ] ++ userModeStrings ++ [ "# Key mappings" ]
|
||||||
|
++ map keyMappingString keyMappings
|
||||||
|
|
||||||
++ [ "# Hooks" ] ++ map hookString hooks);
|
++ [ "# Hooks" ] ++ map hookString hooks);
|
||||||
in pkgs.writeText "kakrc"
|
in pkgs.writeText "kakrc"
|
||||||
|
|
Loading…
Reference in a new issue