I'm making changes to the default keybindings and getting some conflicts. Just unsure how I can unmap a keybinding that I don't need? I tried to hit delete on when selecting the shortcut in the list but to no avail.
P.S. I've tried double clicking the shortcut but no - button appears on the right.
How to delete a keybinding on Xcode ? (using version 9.3 of Xcode)
The first method is obviously the little - that sometimes appears when double-clicking a binding.
The second method is not so quick but (in my experience) just as efficient.
(Here I am assuming you've got a personalised keybinding profile already. If you don't, create one. I'll call it Personal.)
In Xcode: select the shortcut you want to remove and attribute it a random binding (even one that causes conflicts, you'll delete it in two minutes, you don't really care).
Quit Xcode.
Go to ~/Library/Developer/Xcode/UserData/KeyBindings/.
Open the file personal.idekeybindings (it's a simple XML file, any decent text editor should be able to handle it).
Find the shortcut you modified and want to delete by searching its name using command + F.
You should then find something looking like this (each dict corresponds to a modified shortcut):
<dict>
<key>Action</key>
<string>execute:</string>
<key>Alternate</key>
<string>NO</string>
<key>CommandID</key>
<string>Xcode.IDEPlaygroundEditor.CmdDefinition.Execute</string>
<key>Group</key>
<string>Editor Menu for Playground</string>
<key>GroupID</key>
<string>Xcode.IDEPegasusPlaygroundEditor.MenuDefinition.Editor</string>
<key>GroupedAlternate</key>
<string>NO</string>
<key>Keyboard Shortcut</key>
<string>^<</string>
<key>Navigation</key>
<string>NO</string>
<key>Title</key>
<string>Execute Playground</string>
</dict>
Delete this part:
<key>Keyboard Shortcut</key>
<string>^<</string>
Do that for each shortcut you want to remove and don't forget to save the file before closing it. Now open Xcode and check for the shortcut: the space for the keybinding should be empty.
When you double click a key binding, you should see an icon with a minus all the way at the right end of the text box. Simply clicking that icon removes the binding.
Xcode has two kinds of key bindings: ones you can customize within Xcode Preferences and ones you have to customize through System Preferences. The latter kind don't show a "minus" button within Xcode Preferences. To edit these:
Open System Preferences -> Keyboard -> Shortcuts
Click "App Shortcuts" then "+"
Choose "Xcode"
Put in the name and desired shortcut
Voila!
Related
What I really like with a text editor (or IDE) is to be able to easily remap its keyboard shortcuts to what I want, and Xcode seems to do a bad job with this.
I want to be able to switch file tabs by using option + command + arrow (left and right arrows). However, when I try to change keyboard shortcuts for the Show Previous Tab and Show Next Tab actions, the option key is not applied.
In the screenshot, you can see—through KeyCastr—how I pressed the option + command + right arrow keys and end up with command + right arrow in Xcode, the option key is missing.
Is there any solution? Note that the option key can be used on some actions, for example I can use it with the About Xcode action, but this is obviously not what I want.
I'm using Xcode 13.4.1.
Okay so I've found a solution. Not a perfect one but it works!
There is no way to use the option key in some actions because they are constrained by the Navigation in Xcode preferences.
Instead you can change the system preferences to add a new shortcut to the Xcode app.
However, when you will use those keyboard shortcuts in Xcode, you will see a weird behavior where the tab you are switching to, gets opened in a new editor.
This is due to the default navigation preferences of Xcode, change the "Optional Navigation" preference from "Uses Next Editor" to "Uses Tab".
I want to change the key binding set in Xcode 11 some are editable bur some are greyed which I cannot edit, how to unlock it.
Because they are similar to other editable shortcuts thus are treated as something like dependent variables.
In the File Menu section for example, the Close Tab (CMD+W) shortcut is editable. Meanwhile, the similar shortcuts (Close Other Tabs (Option+CMD+W), Close Window (Shift+CMD+W), Close Other Windows (Control+Option+CMD+W), Close All Windows (Option+Shift+CMD+W)) are not editable (greyed).
But when I change Close Tab from (CMD+W) to (CMD+M), the W in the keys of all those similar shortcuts will be changed accordingly to M.
You can verify this on your computer.
To be clear, you cannot edit key bindings that are grayed out. They are generated based on the preceding setting. For example, if the preceding settings is ⌘2 then the grayed out setting below may add ⌥ to become ⌘⌥2.
If you're astonished at how poor this design is, then rest assured that your understanding is correct.
As a workaround, I use BetterTouchTool to remap my shortcuts. For example to "close other tabs" I remap ⌘⇧W (my preferred shortcut) to ⌥⌘W (Xcode's default) and have it only apply to the Xcode app.
I added a shortcut key to "Clear Constraints" in the xcode preferences, and xcode installed the shortcut twice under different xcode names. (See the image.)
The problem is that there is no little "-" (minus) sign (see the red arrow in the image) to remove my duplicate shortcut attempt, because any key I press is interpreted as a shortcut combination.
The problem shortcut(s) are shown below the red arrow. The red arrow one is fine, I just wanted to show the little "-" minus sign there.
Does anyone know how to get around this problem (without reinstalling xcode and all my custom keybindings :-)). Thanks
Image showing duplicate shortcuts below red arrow
Quit Xcode. Restart the computer just to be on the safe side: we want to force Xcode to write its preferences out to disk.
Go to ~Library/Developer/Xcode/UserData/KeyBindings. Open the key bindings file with a good text editor.
You are now editing XML; I presume you know what you're doing. You will see two <dict> entries whose <action> starts with clearConstraints. Delete those entries. Save.
After I've searched on something I want a keyboard shortcut to focus on the search results so I can step through them.
I've looked in XCode's key bindings with no luck.
ctrl+cmd+G
Keybinding is called "Find next in Workspace"
Use Show Find Navigator shortcut (by default it's Cmd+3)
Preferences page screenshot
Ok, maybe they're system shortcuts. I've googled (just a bit) and couldn't find an answer. Maybe there isn't any :) Still..
I love keyboard and I use quite a few in TextMate but just realise I still use the mouse for 2 of the most common actions:
How do I press search and replace after the S/R dialog box is up? - if you press enter it just takes you to the next occurrence of the search string
when I close a file that I don't want to save, how can I choose don't save without touching the mouse?
To select Don't Save from the keyboard, you can use the keyboard shortcut ⌘+D. (This works in most OS X apps, not just TextMate.)
The search and replace (actually it's called "Replace & Find") shortcut is alt-cmd-f and works both inside the Find dialog and without it. With using other shortcuts like cmd-f, shift-cmd-f, cmd-G you can perform most of the search/replace actions without even opening the dialog. For example, if you want to perform the substitution, you press alt-cmd-f, then another is highlighted and if you want to skip it, it's cmd-G, which finds yet another, and so on.
As for the second question, I think it's a general Mac OS X issue -- the message boxes buttons don't have keyboard shortcuts in other apps, too. When I first switched from Windows, this annoyed me but I got used to it by now.
I recently built a web site to store lists of shortcut keys and there is a great list of TextMate Shortcut Keys for Mac on there.
If you know any more you can add them yourself too!
Here's the link http://shortcutkeys.org/software-shortcuts/mac/textmate
If you want to choose the answer for any dialog with the keyboard, go to "System Preferences" > "Keyboard" > "Keyboard Shortcuts". On the bottom of that page there are two radio buttons. Activate "All controls". Now you can switch options of a dialog box with the tab key in every proper OS X application. Note that this is a secondary option, thus you can hit the enter key for the default behaviour or space to trigger your secondary option. Most often it's set to the opposite of the default behaviour, i.e. "Don't save" in a file save dialog and "no" or "cancel" in many many other applications.
I think thats a great feature. Due to the secondary option I always hit either enter or space, depending which option I wanted.