Skip to content

Instantly share code, notes, and snippets.

@tommythorn
Last active February 23, 2026 18:54
Show Gist options
  • Select an option

  • Save tommythorn/070f689735231c46beaa24a6a55aaea6 to your computer and use it in GitHub Desktop.

Select an option

Save tommythorn/070f689735231c46beaa24a6a55aaea6 to your computer and use it in GitHub Desktop.
Bind Option-Space to U+202f (Narrow No-Break Space) to property typeset values and units, eg. 10 kg
# Highly opinionated: The correct typesetting of values with units according
# to most standards (incl. American Physics Society) requires separating the
# value and unit with a _thin_ unbreakable space. Executing the below will
# globally rebind Option-Space on macOS from Non-Break Space (U+00A0) to
# Thin Non-Breaking Space (U+202F)
# Tommy Thorn, 20260223
mkdir -p ~/Library/KeyBindings
cat > ~/Library/KeyBindings/DefaultKeyBinding.dict <<EOF
/* Option-Space to Thin Non-Breaking Space (U+202F) */
"~ " = ("insertText:", "\U202F");
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment