How to type emoji in one keystroke on a Mac

It's easy to create keyboard shortcuts on macOS without using 3rd party apps (like Karabiner) or Text Replacement (which doesn't work in Chrome).
Here's how to do it.

You'll need to edit this Key Binding dict:

$ vi ~/Library/KeyBindings/DefaultKeyBinding.dict

Here's my DefaultKeyBinding.dict as an example:

{
    /* Remap Home/End to Windows-like behavior */
    "\UF729" = "moveToBeginningOfLine:";                    /* Home */
    "\UF72B" = "moveToEndOfLine:";                          /* End */
    "$\UF729" = "moveToBeginningOfLineAndModifySelection:"; /* Shift + Home */
    "$\UF72B" = "moveToEndOfLineAndModifySelection:";       /* Shift + End */

    /* Shortcuts for some unicode symbols */
    "~y" = (insertText:, "đź‘Ť");
}

The emoji shortcut is created in the last line. The tilde (~) means Option should be held down.
Now I can press Option+Y to type a thumbs up emoji. Cool!

Save the file, restart your application, and the new keybinding will take effect in that application.

Here's the full Apple developer documentation on Key Bindings.

One ResponseLeave a Reply

  1. You saved me! Thanks!

Leave a Reply