keymap-editor icon indicating copy to clipboard operation
keymap-editor copied to clipboard

How do I add en and em dashes?

Open carbon-starlight opened this issue 1 year ago • 5 comments

As these are very frequent characters you may find in any book on any page, it's strange not to see them in character picker. How do I add a character that's not in picker?

carbon-starlight avatar Jan 12 '25 19:01 carbon-starlight

I don't think they're defined in the HID spec. If they're not listed in ZMK's documentation (See List of Keycodes) then it's not something you'll be able to select here.

Usually these kinds of things have some OS-specific ways to enter them. With macos, for example, Opt+- will produce and that can be handled in the editor by binding MINUS and toggling the LALT modifier. Windows probably does something similar-ish -- LALT + some number pad sequence, in which case you'd have to define a macro behavior.

nickcoutsos avatar Jan 12 '25 20:01 nickcoutsos

@nickcoutsos Okay... I just discovered that there seems to be no way to enter Cyrillic either. Surely the supposed way to type on languages using Cyrillic script are not altcodes?

carbon-starlight avatar Jan 12 '25 22:01 carbon-starlight

No, but it's not exactly built into HID or ZMK either: ultimately your keyboard will send ANSI QWERTY keys and your OS will need to be configured to interpret them in the desired layout. To help keep things straight people use zmk-locale-generator which provides keycode aliases so that you can refer to the QWERTY-layout keycodes by a more familiar name.

It's come up a few times so I'm just going to refer you to a comment in a previous post: https://github.com/nickcoutsos/keymap-editor/discussions/203#discussioncomment-8907451

nickcoutsos avatar Jan 12 '25 23:01 nickcoutsos

So... How can I bind one key to output a sequence on a single press? Like Ctrl + Shift + U, release, then 2014, and then Enter?

carbon-starlight avatar Jan 16 '25 14:01 carbon-starlight

That's going to need a macro. You can read up on them in ZMK's documentation: https://zmk.dev/docs/keymaps/behaviors/macros

That'll look something like:

        new_macro: new_macro {
            compatible = "zmk,behavior-macro";
            #binding-cells = <0>;
            bindings = <&kp LS(LC(U)) &kp N2 &kp N0 &kp N1 &kp N4 &kp RET>;
            label = "NEW_MACRO";
        };

In the app you can build it up key-by-key like:

Image

Depending on your use-case (I think games usually) it may not accept the modifiers being sent with the same press-release as the key so if you need to break it apart you can use the &macro_press/&macro_tap/&macro_release directives:

        new_macro: new_macro {
            compatible = "zmk,behavior-macro";
            #binding-cells = <0>;
            bindings =
                <&macro_press>,
                <&kp LC(LSHFT)>,
                <&macro_tap>,
                <&kp U>,
                <&macro_release>,
                <&kp LC(LSHFT)>,
                <&macro_tap>,
                <&kp N2 &kp N0 &kp N1 &kp N4 &kp RET>;

            label = "NEW_MACRO";
        };
Image

nickcoutsos avatar Jan 16 '25 17:01 nickcoutsos