DEV Community

Jaakko Pallari
Jaakko Pallari

Posted on • Originally published at lepovirta.org on

Ctrl-Meta-Space in iTerm2

In Emacs, there’s a handy command called mark-sexp. It marks the rest of the current s-expression from the cursor’s position. It’s mapped to C-M-SPC (ctrl + meta + space) by default, which is compatible with terminal applications.

However, if you have option key mapped to +Esc in iTerm2, pressing ctrl + option + space is interpreted as meta + space instead. To fix this, you need to add an additional keybinding to your session’s key bindings.

  1. In iTerm2, open: Preferences > Profiles > some session you wish to edit > Keys.
  2. Add a new key binding by pressing the “+” button.
  3. Select the “Keyboard Shortcut” field, and press ctrl + option + space.
  4. Select “Send Hex Code” in the “Action” list.
  5. Type “0x1b 0x00” to the field below the list.
  6. Click OK and close the preferences window.

C-M-SPC now works in all the new terminal windows that use the edited session. You can also make the same changes for running terminals by editing the running session.

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay