Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to disable the annoying Option-Space key combination for non-breaking spaces?

This is very very annoying in Eclipse or the terminal as I often type the non-breaking space instead of a regular one.

share|improve this question
FWIW, It's referred to as the option key rather than the alt key on a Mac. – Chealion Dec 4 '09 at 7:04

Make your ~/Library/KeyBindings/DefaultKeyBinding.dict file look like this (if it doesn’t exist create it, if there are already bindings in it just add the one from below):

"~ " = ("insertText:", " ");

What does this do? Every time you press Option-Space instead of inserting a non breaking space OS X now inserts a regular space. Problem fixed.

share|improve this answer
I couldn't get this work on OSX 10.7 :( – Eemeli Kantola Sep 17 '12 at 8:43
@EemeliKantola It still works for me, but you have to reopen applications to apply the changes. Terminal, Xcode, and many cross-platform applications don't support DefaultKeyBinding.dict. – user495470 Sep 25 '12 at 12:23
@LauriRanta Terminal seems to support the DefaultKeyBinding.dict file. – Ragnar123 Jan 24 '14 at 15:36
This works on Yosemite 10.10.2. I've created the directory and the file from scratch. Thanks a bunch! – Petr Cibulka Apr 6 '15 at 2:11
Also worked for me on El Capitan, OS X 10.11. Thanks! – n2o Oct 13 '15 at 14:08

As mentioned in the comments, the solution provided by Martin does not work in some applications, most importantly (for me) in my editor, Sublime Text 2.

So for all of you who are troubled by none breaking spaces in your code, you can add the following custom keybinding into your user keymap ("Sublime Text 2 > Preferences > Key Bindings - User"):

{ "keys": ["alt+space"], "command": "insert_snippet", "args": {"contents": " " } }

This will insert a regular space instead of a non-breaking one.

share|improve this answer

I use iTerm2 for most of my work and the mapping can be added in the "Keys" preference pane, by adding a new key combination in Preferences -> Keys -> the plus button. Note when adding the key make sure to put a single space in the lower box as shown.

screencap of adding the keyboard shortcut

share|improve this answer
Very good solution! Heck, I'm still getting valuable information from a four year old post. :-) – Malax Nov 26 '13 at 14:12
You make my day! – Enrique Marcos Mar 17 '14 at 13:23

You could also create a custom keyboard layout with Ukelele (see or use KeyRemap4MacBook:

  <name>Non-Breaking Space to Normal Space</name>
  <appendix>(Option+Space to Space)</appendix>
  <appendix>(Option+Shift+Space to Space)</appendix>
  <autogen>__KeyToKey__ KeyCode::SPACE, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_OPTION | ModifierFlag::NONE, KeyCode::SPACE</autogen>
share|improve this answer

Since this is the answer that Google shows you when searching for "How to disable non-breaking spaces in Sublime Text" (see x3ro's answer) I thought I'd post the answer for Sublime Text on Linux. Add this to your key bindings:

{ "keys": [" "], "command": "insert_snippet", "args": { "contents": " " } }

Go to "Preferences" → "Key bindings - User" to edit your key bindings.

Note that the space in "keys": [" "] is a non-breaking space.

Also note that this key binding also affects widgets, like the search box. In other words, you can no longer type non-breaking spaces into your search box, which could be a problem. To disable non-breaking spaces just in the text editor, use this key binding instead:

    "keys": [" "],
    "command": "insert_snippet", "args": { "contents": " " },
    "context": [
        { "key": "setting.is_widget", "operand": false }
share|improve this answer

For me the the KeyBindings fix didn't work. I use Coda2 as an editor. I managed to get the replacement to work with BetterTouchTool though.

BetterTouchTool: "Keyboard > Add New Shortcut" then type "alt + space" in "Keyboard Shortcut" and "Space" in "Trigger other Keyboard Shortcut"

share|improve this answer

A possible global solution is to set alt-space to something else like Show Notification Center in System Preferences > Keyboard > Shortcuts > Mission Control.

enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.