diff --git a/config/cradio.keymap b/config/cradio.keymap index f97b005..a00b6f8 100644 --- a/config/cradio.keymap +++ b/config/cradio.keymap @@ -14,6 +14,8 @@ #include #include +#define TO_STRING(x) #x + #define DEF 0 #define NAV 1 #define NUM 2 @@ -41,92 +43,31 @@ ignore-modifiers; }; +#define HM(NAME, TAP, HT_KEYPOS) \ + NAME: NAME { \ + compatible = "zmk,behavior-hold-tap"; \ + label = TO_STRING(HM_ ## NAME); \ + #binding-cells = <2>; \ + tapping-term-ms = <280>; \ + quick-tap-ms = <175>; \ + require-prior-idle-ms = <175>; \ + flavor = "balanced"; \ + bindings = <&kp>, ; \ + hold-trigger-key-positions = ; \ + hold-trigger-on-release; \ + }; + / { behaviors { - hmr: hmr { - compatible = "zmk,behavior-hold-tap"; - label = "HMR"; - bindings = <&kp>, <&kp>; - - #binding-cells = <2>; - tapping-term-ms = <280>; - quick-tap-ms = <175>; - require-prior-idle-ms = <175>; - flavor = "balanced"; - hold-trigger-on-release; - hold-trigger-key-positions = ; - }; - - hml: hml { - compatible = "zmk,behavior-hold-tap"; - label = "HML"; - bindings = <&kp>, <&kp>; - - #binding-cells = <2>; - tapping-term-ms = <280>; - quick-tap-ms = <175>; - require-prior-idle-ms = <175>; - flavor = "balanced"; - hold-trigger-on-release; - hold-trigger-key-positions = ; - }; - - hml_repeat: hml_repeat { - compatible = "zmk,behavior-hold-tap"; - label = "HML_REPEAT"; - bindings = <&kp>, <&key_repeat>; - #binding-cells = <2>; - tapping-term-ms = <280>; - quick-tap-ms = <175>; - require-prior-idle-ms = <175>; - flavor = "balanced"; - hold-trigger-on-release; - hold-trigger-key-positions = ; - }; - - hmr_lpar_lt: hmr_lpar_lt { - compatible = "zmk,behavior-hold-tap"; - label = "HMR_LPAR_LT"; - bindings = <&kp>, <&lpar_lt>; - - #binding-cells = <2>; - tapping-term-ms = <280>; - quick-tap-ms = <175>; - require-prior-idle-ms = <150>; - flavor = "balanced"; - hold-trigger-on-release; - hold-trigger-key-positions = ; - }; - - hmr_rpar_gt: hmr_rpar_gt { - compatible = "zmk,behavior-hold-tap"; - label = "HMR_RPAR_GT"; - bindings = <&kp>, <&rpar_gt>; - - #binding-cells = <2>; - tapping-term-ms = <280>; - quick-tap-ms = <175>; - require-prior-idle-ms = <150>; - flavor = "balanced"; - hold-trigger-on-release; - hold-trigger-key-positions = ; - }; + HM(hml, &kp, KEYS_R) + HM(hml_repeat, &key_repeat, KEYS_R) - hmr_par_lgt: hmr_par_lgt { - compatible = "zmk,behavior-hold-tap"; - label = "HMR_PAR_LGT"; - bindings = <&kp>, <&par_lgt>; - - #binding-cells = <2>; - tapping-term-ms = <280>; - quick-tap-ms = <175>; - require-prior-idle-ms = <150>; - flavor = "balanced"; - hold-trigger-on-release; - hold-trigger-key-positions = ; - }; + HM(hmr, &kp, KEYS_L) + HM(hmr_lpar_lt, &lpar_lt, KEYS_L) + HM(hmr_rpar_gt, &rpar_gt, KEYS_L) + HM(hmr_par_lgt, &par_lgt, KEYS_L) td_scw: td_shift_caps_word { compatible = "zmk,behavior-tap-dance";