2

There's a pretty general solution for disabling the non-breaking space in OS X for some apps:

https://superuser.com/questions/78245/how-to-disable-the-option-space-key-combination-for-non-breaking-spaces

Unfortunately, Xcode is not one of them, and the solution does not work.

Any ideas on how to disable Option-Space for Xcode specifically?

I'm using a slightly customized keyboard layout, created with Ukulele; perhaps it could be used to remap that particular combination?

I'd rather not use stuff like KeyRemap4Macbook (or whatever it's called), since I've experienced a considerable, unacceptable lag during typing when using that app with some remaps.

1 Answer 1

3
+100

I have found a somehow dirty workaround to disable the key combination for Xcode only:

To disable alt/optspace add a new keybinding in the file IDETextKeyBindingSet.plist in the folder /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources.

Open the plist and add a new dictionary called 'Customized'. Create a new child named 'Insert No Alt-Space' with type 'String' and the value 'InsertSpace:'. Save the file.

Open Xcode -> Preferences -> Key Bindings -> Customized
Highlight 'Insert No Alt-Space' -> Key and enter alt/optspace.

In the future you will get an audible error message typing the combination but nothing will be written.

Until now i haven't found a method to just insert a space instead of a non-breaking space.

Probably you have to redo the modification with every new Xcode version.

5
  • 1
    Thanks for your answer. While this is indeed a solution that would require re-applying the patch on each update, so far it's the only one that works. The bounty is yours. Commented Apr 9, 2015 at 5:34
  • not working with Xcode 8 any more, btw Commented Jan 17, 2017 at 22:41
  • Works as described in Xcode 10. Commented Sep 15, 2018 at 5:39
  • It's kind of work for me (Xcode 12.3). Kind of: pressing Opt+Space no longer produce any non-breaking space or space at all. Nothing happens except the macOS alert sound. Thanks anyway! :)
    – frouo
    Commented Feb 3, 2021 at 21:25
  • Could you post an example code snippet on how to add this? I inserted everything in the top-level dict. Or is it another top-level dict? I added the entry but Customized in the IDE does not show the entry
    – IceFire
    Commented Mar 20, 2021 at 8:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .