A key combination inserts invisible and festy character in Xcode
Solution 1:
I don't think this is possible in Xcode.
This happens because ctrl+x indicates to Xcode that you want to type one of the ASCII control characters. The next thing you type tells it which one. Pressing ctrl+s inserts an ASCII 19, "device control 3". Different letters insert different control characters-- see the chart at that link for a full list. Control characters are not printable, so it's invisible. Unfortunately Xcode's option to show invisibles (Edit menu --> Invisibles) doesn't show ASCII control characters, so you end up with something Xcode doesn't like but that you can't see.
You might be able to use Karabiner to deal with this, I'm not sure though.
Solution 2:
Karabiner is free, but it is a little complicated to add a per-application rule. You need to create an entry for a "Complex Modification" written in JSON, in ~/.config/karabiner/karabiner.json
. See karabiner.json Reference Manual
Another option is BetterTouchTool. It's not free, but is easier to configure, and has many other features. In the preferences, you would do this:
- Add Xcode in the application sidebar
- Click the Keyboard tab
- Click "Add New Shortcut or Key Sequence"
- Press control-X in the Shortcut box
- Leave the "Trigger Predefined Action" at "No Action".