in the past (older version of xcode) I had a plus sign in the top right of an editor to add a tab. Then in the new tab I could click on the second file and I had 2 files open in 2 tabs.
My plus sign is gone (I guess with my last update).
How to rollback this + button or how to have tabbed editors in Xcode 6.4 (6E35b) ?
You can show the tab bar (with the + button you mention) from the View menu:
Alternatively you can press CMD+T to open a new tab, which will automatically show the tab bar.
File -> New -> Tab and the + sign will appear
You can use -- Command + T or you can follow this also
Related
I am trying to customize the Xcode 12.2 keyboard shortcuts for "Show Previous Tab" and "Show Next Tab". These are the new document tabs that were introduced in Xcode 12, as opposed to the old window tabs. (The document tab bar is below the window tab bar.)
When I go to Preferences > Key Bindings, and try to record shortcuts for "Show Previous Tab" and "Show Next Tab", the settings panel records ⌘⌥← as ⌘← and ⌘⌥→ as ⌘→. Basically, the option key disappears.
This is a problem only for those two shortcuts. If I try to customize "Show Previous Window Tab" and "Show Next Window Tab", I can record ⌘⌥← / ⌘⌥→ just fine.
Previously, I used System Preferences > Keyboard > Shortcuts > App Shortcuts to customize "Show Previous Tab" / "Show Next Tab" for "All Applications". I removed this, and it still didn't fix this issue in Xcode.
What you want is to change Navigation Style to "Open in Place" in the Xcode preferences. Then the whole silly tabs in tabs thing will go away and you can go back to just using App shortcuts like you used to.
For the record, I previously used shortcuts defined in Xcode, where it actually was possible to define option as a part of a shortcut for Show next and show previous tab, but had to go with App shortcuts now due to the behaviour you describe.
This is the article where I found the above info: https://www.jessesquires.com/blog/2020/07/24/how-to-fix-the-incomprehensible-tabs-in-xcode-12/
TL;DR: I had to use the system preferences -> keyboard -> shortcuts and set all four of these shortcuts. Which had a weird lag when it was setting them.
Show Previous Tab
Show Next Tab
Previous Window Tab
Next Window Tab
Long version: I tried the below first which should be the correct answer but it didn't work for me. Please let me know if it works for you.
I wish this worked because it looks like it would be awesome.
XCode -> Preferences -> Key Bindings
Use the the search Filter on the right side to search for:
Show Previous Tab
Show Next Tab
Previous Window Tab
Next Window Tab
In Xcode 10, the toolbar had an inter-locking ring icon which showed the assistant editor, it's missing in Xcode 11.
In Xcode 10, the toolbar had an inter-locking ring icon which showed the assistant editor, it's missing in Xcode 11.
The interface has changed a little, but the functionality is still there. The top right corner of the editor pane has two buttons:
Clicking the left button, which looks like lines of text, displays the popup menu, where you can choose various editor configuration options. Clicking the right button just narrows the existing editor and adds another one next to it.
Some of the same options are also available in the Editor menu in the main menu bar.
Update: This is from the Xcode 11 beta release notes, and perhaps more fully explains why the UI was changed:
Editors can be added to any window without needing the Assistant Editor. Editors are added using the “Add Editor” button in the jump bar or the File > New > Editor command. Each editor can now be in one of three modes: “Editor Only”, “Editor and Assistant” or “Editor and Canvas”. The latter two modes automatically show relevant content when available. When using multiple editors, the View > Editor > Focus command can be used to temporarily expand the active editor to fill the entire window, hiding other editors. For source control support, the Code Review button in the Toolbar replaces the Comparison Editor. The “Show Authors” command is now available from the Source Editor’s Editor menu. The SCM Log is now in the Inspector Area. (43806898)
With multiple editors possible in a window, you need editor-specific controls for showing the ancillary views like the assistant editor, author view, etc.
From SMGreenfield's comment:
Sometimes I want to look at a different part of the same darn document. There has always been a way to do this, but it involved jumping through hoops.
Just add another editor: click the Add Editor button in the upper right corner of the editor, or choose File > New > Editor. The new editor will default to showing the same file you were working on in the existing editor.
If new editors show up on the right of the existing editor and you'd prefer them to stack vertically, you can choose View > Change Editor Orientation. If you want them to stack horizontally most of the time (the default) but just want one to show up below, choose File > New > Editor Below.
Shortcuts :
control + option + command + return : Show Assistant Editor
command + return : Show Editor only (hide Assistant Editor)
Using Editor on the Toolbar
It has moved, to show it click on icon with horizontal lines and select Assistant.
In Xcode 11 we now have multiple editor panes. You can summon a second pane, a third pane, as many as you like.
When you have a second pane, it does not have to be an automatic assistant. In other words, the editor pane itself either is an assistant or it is not. So if it is not, it is manual. And if it is, it is automatic.
To toggle between being an assistant and being an ordinary pane, choose Assistant from the Editor menu:
If Assistant is checked, this is an assistant and is automatic. What it displays depends automatically on some other pane.
If Assistant is unchecked, this is an ordinary editor pane and is manual. You can display anything you like in this editor.
In case you can't use Add Editor button just use shortcut:
Cmd + Ctrl + Shift + Enter
Turn Assistant on by navigating to the following in Xcode 11:-
Xcode > Editor > Assistant
For Xcode 11.2.1
command + option + return
or
Main Menu -> Editor -> Line View
it is worth noting, that you can also open the assistant editor by alt-clicking the file
Xcode 9 seems to be missing jump to definition shortcut Option-Shift-Command+Click. You used to be able to use to open definition in a new tab, window, or other navigation areas with Option-Shift-Command+Click. In Xcode 9 this still works from the file navigator but not when you use this on a class. Has anyone been able to figure out how to use this shortcut in xcode 9?
You can use Xcode preferences to personalise the double click and the action selector.
From this window you can change CMD + click to open the definition instead of the action selector (as it was in Xcode 8)
you can also change the behaviour of optional navigation, so that it opens a tab
By setting the configuration as shown below, you can CMD + ALT + click to jump to definition in a new tab.
This also restores Option-Shift-Command+Click to show the window selector as you wanted
Marco's screenshot was helpful.
The keyboard commands for Xcode 9 have changed:
Jump to Definition
Same window : Command-Control-click (was Command-double-click)
In assistant pane : Command-Option-Control-click
In separate window/pane : Command-Option-Control-Shift-click
Quick Help
Option-click (same as Xcode 8)
As soon as I asked a question I found a solution by accident.
Command + click on the class to bring up the new action selector
Shift + Alt + Click to chose where to open (tab, new window, etc)
Alternatively, can use Command + Option + Control + Shift to do this all at once but I'm not sure how convenient that is
First, Open the file.
Then:
New Window : Cmd + Shift + t
The Assistance Editor : Cmd + t
Once I start editing my code and adding for loops or if then statements my code indentation is whacked because the previous code maintains its former indentation instead of adjusting automatically.
In Visual Studio you can highlight code and select 'format selection' to fix these issues - is there anything similar in Xcode?
Before Xcode 9 (for Xcode 9 see default shortcut below)
select text
right-click
there's a "Re-indent selection" item in popup menu
In XCode 4 there is one more step:
select text
right-click
Click on "Structure"
there's a "Re-indent selection" and other options in popup menu
Or using the default shortcut:
select text
press ctrl + i
select text
press Control-I (the default keyboard shortcut)
You can do this automatically in Xcode 11
In Xcode 4.6.3, choose Editor > Structure > Re-Indent.
Shortcut: Control + I
(that's 'i', for 'indent')
This works on current selection. If no text selected, choose Edit > Select All (⌘+A) and then perform the re-indent.
(I'm more clearly restating the other answers)
These solutions re-indent text to the default xCode behaviors. To change these behaviors, go to xCode (v.4) > Preferences > Text Editing. Then to Indentation Tab.
Xcode 9.2:
You can select text and press ctrl + i to re-indent code.
You can do it in different ways, but these two are the easiest
select text ( ⌘ +a) :
Using shortcut -> (control)^ + i
Click on "Editor" -> Click on "Structure" -> Click on "Re-indent"
Sometimes setting Xcode global preferences is not enough for ^ + i to do its job accordingly. The reason is that project settings override global ones. You can set indentations for a concrete project or even a file.
Select project (or file) in the Navigation Pane. Then in File Inspector go to Text Settings section and set desired number of tabs or spaces for indents.
To quickly re-indent the whole file:
⌘+a
⌘+x
⌘+v
Edit: No longer working in Xcode 11
You can try my extension Swimat
https://github.com/Jintin/Swimat
It support format on selection.
Simple install by brew cask install swimat
Is there any way to remove all the breakpoints in Xcode?
Well there's a 3 step way:
Press CMD(⌘)+7 to show all breakpoints.
In Xcode4 press CMD(⌘)+6, in Xcode3 press CMD(⌘)+ALT+B.
Select all breakpoints with CMD(⌘)+A and delete them, like deleting text, with backspace.
There's no step 3 :)
Its very easy to do in new Xcode. Just click on breakpoints Tab then select all then delete.
Xcode 10 Screenshot:
Old Xcode Screenshot:
tap. See attach image for clear reference.
In Xcode, you can also do by right clicking the project name on the breakpoints tab and then you can see the options for deleting all breakpoints including disabling and sharing breakpoints.
In Xcode 4, in the debugger console, type "breakpoint delete" or "br del" for short:
(lldb) br del
About to delete all breakpoints, do you want to do that?: [Y/n] y
All breakpoints removed. (1 breakpoints)
(lldb)
You can't rely on the GUI breakpoint list, since nothing you enter from the command line will show up there.
Other ways:
Select Breakpoints group in Groups and Files tree, click in Detail view, Command-A, Delete
Disclose Breakpoints smartgroup in Groups and Files tree, shift- or command-select breakpoints in outline, press Delete
Run > Console, when app is paused, type "delete breakpoints" and press Return
Xcode 10
The most easiest way is to do ⌘ + y to disable enable breakpoints .
There is another way
go to Xcode project navigations pane
Click on show Breakpoint navigator
Right click on the project file and select disable all break points
In Xcode 9 it's CMD(⌘) + 8 to access all breakpoints, you can also just click here:
Then you can select and delete them.
Additionally, you can customize your Toolbar and put the "Breakpoints" button there. Click this on/off will active/deactivate all breakpoints. While this doesn't remove them, it may be useful if you just don't want them to be hit for a run.
As an addition to mxg 's answer above:
in Xcode 5 it's been changed to CMD(⌘) + 7
For Xcode 5:
In ToolBar, select Navigate -> select Reveal in Project Navigator -> In Navigator area, select Show the Breakpoint Navigator.
Here, You can edit, hide/unhide, share, move the breakpoint for each and every class.
Note: Because of Xcode newbie's, am explained the steps from toolbar to show the Breakpoint Navigator.
For XCode 12:
Press CMD ⌘ + 8
Select All (CMD ⌘ + A)
Right Click and Select "Delete Breakpoints"
For XCode 12.4
Click on Debug in Toolbar
Choose Breakpoints
Then Click on Delete All Breakpoints
That's it!!
CMD(⌘) + a
CMD(⌘) + /
CMD(⌘) + /
In XCode 7 you can just drag a bp into the project view window and an X will appear, release mouse and it will be deleted.