Unable to use option key in some Xcode keyboard shortcuts - xcode

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".

Related

How to edit greyed key bindings set in Xcode 11

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.

Rearrange Code shortcut in Resharper doesn't work in VS2015

When I try to use the shortcut for moving lines up/down (Ctrl+Alt+Shift+↑/↓), it highlights the code and shows the tooltip message "Use Up/Down to move text line" but nothing happens. If however I try the same command via the menu bar (Resharper > Edit > Rearrange Code > Move Up) it moves the selected lines as expected.
I used to use this feature all the time so I find this bug very annoying. Apparantly, others also experience this (see comments for Resharper move line up down not working) but I haven't been able to find a solution for it. Resetting keyboard layouts and reapplying VS keyboard schemes doesn't work.
Has anyone been able to resolve this issue?
[EDIT]
Reason of this is issue (when you are logging to machine with VS and Resharper via Remote Desktop) is that Ctrl-Alt-Left Arrow/Ctrl-Alt-Right Arrow combinations are not sent to your virtual machine
There are two workarounds:
My first soultion (change combination see below)
You can use AutoHotKey script as stated in thread:
https://superuser.com/questions/327866/remote-desktop-sending-ctrl-alt-left-arrow-ctrl-alt-right-arrow-to-the-remote-p
[/EDIT]
Reason is
duplication of the same hotkeys which could be found in 'Shortcut currently used by:' combobox
Fix is
I described process for _MoveRight shortcut - for other shortcuts it works the same
STEP 1 Check for conflicting changes
seeImage
go to Tool --> Options --> Keyboard
in field 'Show commands containing' find your command (moveright in example)
click in field 'Press shortcut keys' press ALT + RIGHT ARROW
in field Shortcut currently used by you will find conflicting shortcut -
Edit.CompleteWord...
STEP 2 Now we need to delete this shortcut
in field 'Show commands containing' write Edit.CompleteWord
you should see ALT + RIGHT ARROW shortcut in field 'Shortcuts for selected command
click Remove button
STEP 3 Now we need to add our shortcut to _MoveRight function
in field 'Show commands containing' find your command (moveright in example)
click in field 'Press shortcut keys' press ALT + RIGHT ARROW
click Assign

Xcode: Is it possible to 'Open Quickly' the right pane of the Assistant Editor?

Is it possible to 'Open Quickly' in the right pane of the Assistant Editor? This would increase productivity by like 20x
Yes it's possible, but depending on your Xcode version you may need to adjust the default behavior in Xcode's preferences.
Use ⌘ command+⇧ shift+O to open the "Open Quicky" input box, and then:
Use ⌥ option+Enter to open the file in the right editor.
Use ⌥ option+Shift+Enter to select where you want to open the file using the arrow keys.
On Xcode 12, the default action of ⌥ option+Enter is to open the file in a new "Tab" (which are new in this release, and different from a "Window Tab"). This is still configurable in the preferences.
On Xcode 11, you can split the editor as much as you want. This means ⌥ option+Enter by default will open the file in the editor next to where your cursor currently is.
This behavior is configurable in Xcode's Preferences, under Navigation:
To have ⌥ option+Enter open the selected file in the editor on the right of the Xcode window, select "Optional Navigation: Uses Second Editor".
Make sure that Uses Focused Editor is selected in Preferences > Navigation:
This way, you can open it by focusing the Assistant Editor, pressing ⌘ command+⇧ shift+O to open the Open Quicky input box, and just press Enter to open the selected file, instead of ⌥ alt+Enter.
An even easier way is to hold down the Option key and then click on the file. That will bring open the chosen file in the Assistant Editor. This works great when you TDD your Swift :) You can have your tests on the left and option click on the implementation to open on the right.
Cool thing!
Just to extend the answer you can switch between more then two Tabs or open it new editor tab cool isn't it?
• Open multiple assistant editor .
• ⌘ command+⇧ shift+O.
• Hold ⌥ option and press Enter on the selected item.(Used to open any file in Assistant Editor)
• You can also use ⌥ option+⇧ shift+Enter to toggle more and
open new tab if you're not on stacked editor.
• The multiple selection window will appear
Note: Make sure you have all editor stacked selected
In addition to Guillaume's answer, be mindful that the editor is not in the single editor mode (I don't know what it should be called officially though) that you can disable by selecting this button, otherwise all navigations become "Uses Focused Editor":
EDIT: misread your question above answer is good, just make sure you click into that pane before trying those commands
Sounds like your looking for some hotkeys, check here for a full list
http://spin.atomicobject.com/2014/03/23/xcode-keyboard-shortcuts/
http://iphonedev.tv/blog/2014/9/15/14-xcode-time-saving-shortcuts-memorize-and-improve-your-productivity
http://nshipster.com/xcode-key-bindings-and-gestures/
but to open assistant editor use ⌘ command + ⌥ option + ↵ return

Xcode - cycle through previously opened documents

I would like to have ctrl-tab behavior in Xcode (4.6, if that's relevant)-- is that available?
I do NOT mean behavior described as in the answer to this question:
Xcode - cycle through open windows
That is, cmd-` is not what I want to do, because I don't want to use multiple windows.
I mean, I want the editor to behave like Visual Studio or Netbeans, and be able to cycle through the files that I've opened in the same real estate. I don't like having a cloud of windows to navigate through. Is this possible, or is this idiom just not something in Xcode at all?
You can use control-2 to bring up the history menu, then up and down to select the file you want. Then control-3 to move forward.
Try ctrl + cmd + left Arrow/right Arrow
One approach is to use more tabs. In the General tab of Xcode's Preferences (as of Xcode 4.6.3), set “Double Click Navigation” to “Use Separate Tab”:
Then, when you open files by double-clicking them, they will open in new tabs. You can navigate between tabs by typing ⌘ { and ⌘ } (command-shift-left bracket and command-shift-right bracket). You can rebind the “Select Next Tab” and “Select Previous Tab” commands in the Key Bindings preferences if you want to use other keys.
I think what you want is the following:
Sorry for using Xcode 5 here, but I think that might be more future-proof and it's the same in Xcode 4.X.
As far as I know there is no shortcut for that behavior but - as in any web view - you can swipe with your finger (1 finger on the Magic Mouse, 2 finger on the Trackpad).

2 basic Textmate shortcuts 'don't save' and 'replace all'

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.

Resources