What Xcode keyboard shortcuts do you use regularly? [closed] - xcode

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
What Xcode keyboard shortcuts do you use regularly?
I am a huge believer in using the keyboard as much as possible (its much faster that way), and I was hoping others could share some of the Xcode shortcuts they use.

I find the shortcuts to open & close various areas of the screen must useful.

Cmd + Shift + o opens the "Open quickly" dialog, where you can quickly find and open files that contain the text you enter.

Updated for newer versions:
Control + Command + ↑
Switches between corresponding .h / .m files or as Apple's own documentation, it means Jump to Counterpart

command + shift + j
Reveals the current file in the project navigator. Very useful if you use command + control + J to jump to a definition as Xcode won't automatically reveal the containing file in the navigator.

command /
Comment out the current line, or multiple lines if they're highlighted.
Comes in handy for quick commenting and uncommenting while experimenting with code.

Re-indent. It's in Edit > Format > Re-Indent and there's no shortcut by default (I use Command + Shift + L). It's a godsend.

command F Search in the File
option command F Search & Replace in the File
shift command F Search in the whole project
shift option command F Search & Replace in the whole project
Notice the pattern for easy memorizing.

Ctrl + Command + ↑ - Switch between header and implementation files.

Command + J
(Move focus to any section of the editor)

Control + Command + j
Highlight a keyword (method name) and jump to its definition. Also works for variables, #defines, etc.

Some of my favorite shortcuts are not keyboard shortcuts at all, but multitouch gestures. All Macbooks from early 2008 onward, and I would imagine desktops with a Magic Mouse or Magic Trackpad, support three-finger-swipe up and down to switch between the header and implementation, and three-finger-swipe left and right to navigate within the file history.

Command + Shift + Y for the console.

I find a cheat sheet next to the computer is the best way to pick up useful shortcuts. Cocoa Samurai has a good one.

Key Bindings to XCode Actions
Create your own keyboard shortcuts using the Text Key Bindings tab of the Key Bindings preference pane. A time-saver all its own. Just lookup your favourite actions and add/edit shortcuts!
Another thread you may find useful is here.

Just the basic emacs navigation. Feels so right.

I cannot live without three finger vertical swipe to switch between interface and implementation file. If you miss that in xcode-4/Lion, make sure to follow the following instructions:
http://geeksinkilts.com/?p=67

Related

Xcode keyboard shortcut: jump to test file?

Is there an Xcode keyboard shortcut to jump from MyObject.m to MyObjectTests.m, and vice versa? If so, what is it?
I haven't found a way to do this. Feature request material I think.
At the bottom of "Project Navigator" you can type your filename in the search area to dynamically search for files you would be interested in. They will be filtered as you type.
If you always place your ClassTests next to its Class, you can use Control + 5 followed by Up/Down and Return. Three keystrokes. Not ideal but works.
Command + Shift + O works fairly well. It is an open quickly command, so you can type in the name of the file and get a list of:
MyObject.m
MyObject.h
MyObjectTests.m
It remembers what you typed last too, so next time you Command + Shift + O (in the same XCode instance) you can now down arrow twice and return to get from source to test file. Works in XCode 6.3 / 6.4; I am not sure about other versions.
If you already know the name of the test file where the relevant tests are located, then of course the above answers work well. But if you don't know where the tests are (such as when you inherited an old code base or it's been more than 2 days since you wrote it), there are two ways to do it.
The keyboard shortcut ctrl-cmd-up will take you to the "generated interface" (a leftover from the objc days) for that file, but pressing it a second time will take you to the associated test file
Use the assistant editor, which can be turned on either through the little menu in the top right corner, or through the keyboard shortcut ctrl-opt-cmd-enter. This will usually show the test file for an associated file (or vice versa if you're looking a test file!)

Favorite Visual Studio keyboard remappings? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
Stack Overflow has covered favorite short-cuts and add-ins, optimizations and preferences -- great topics all. If this one has been covered, I can't find it -- so thanks in advance for the link.
What are your favorite Visual Studio keyboard remappings?
Mine are motivated by the fact that I'm a touch-typist. Mouse, function keys, arrow keys, Home, End -- bleh. These are commands I do all day every day, so I've remapped them to sequences I can execute without moving my hands from the home row.
The command that is remapped in Tools => Customize => [Keyboard] is shown in parentheses.
I'm 100% positive that there are better remappings than these, so please post yours! Please include the command; oft times, figuring it out is a challenge.
-- Hoytster
Running the app and operating the debugger
Ctrl+Q + Ctrl+R Run the application, in debug mode (Debug.Start)
Ctrl+Q + Ctrl+Q Quit (stop) the application (Debug.StopDebugging)
Ctrl+T Toggle a breakpoint at the current line (Debug.ToggleBreakpoint)
Ctrl+K + Ctrl+I Step Into the method (Debug.StepInto)
Ctrl+K + Ctrl+O Step Out of the method (Debug.StepOut)
Ctrl+N Step over the method to the Next statement (Debug.StepOver)
Ctrl+K + Ctrl+H Run the code, stopping Here at the cursor position (Debug.RunToCursor)
Ctrl+K + Ctrl+E Set then next statement to Execute (Debug.SetNextStatement)
Navigating the code
Ctrl+S Move a character LEFT (Edit.CharLeft)
Ctrl+D Move a character RIGHT (Edit.CharRight)
Ctrl+Q + Ctrl+S Move to the LEFT END of the current line (Edit.LineStart)
Ctrl+Q + Ctrl+D Move to the RIGHT END of the current line (Edit.LineEnd)
Ctrl+E Move a line UP (Edit.LineUp)
Ctrl+X Move a line DOWN (Edit.LineDown)
Ctrl+K + Ctrl+K Toggle (add or remove) bookmark (Edit.ToggleBookmark)
Ctrl+K + Ctrl+N Move to the NEXT bookmark (Edit.NextBookmark)
Ctrl+K + Ctrl+P Move to the PREVIOUS bookmark (Edit.PreviousBookmark)
Ctrl+Q + Ctrl+W Save all modified Windows (File.SaveAll)
Ctrl+L Find the NEXT instance of the search string (Edit.FindNext)
Ctrl+K + Ctrl+L Find the PREVIOUS instance of the search string (Edit.FindPrevious)
Ctrl+Q + Ctrl+L Drop down the list of open files (Window.ShowEzMDIFileList)
The last sequence is like clicking the downward-facing triangle in the upper-right corner of the code editor window. VS will display a list of all the open windows. You can select from the list by typing the file name; the matching file will be selected as you type. Pause for a second and resume typing, and the matching process starts over, so you can select a different file. Nice, VS Team. The key takes you to the tab for the selected file.
OK, it's a community wiki; edit away. :)
Tools -> Options -> Keyboard -> Apply the following additional keyboard mapping scheme -> Emacs
For editing and rearranging I've found the following 3 very useful, even though they're not on the home row:
Keypad + for Edit.Copy
Keypad - for Edit.Cut
Keypad * for Edit.Paste
These are easy to hit (even with the right thumb, at a pinch, if your right hand is holding the mouse) and require no meta keys. I often work by writing snippets then turning it into compilable code using search and replace, and then copying in words from elsewhere. The second step is usually most efficiently done by using the cursor with the mouse, so I've not found it a problem that these keys are so far away from the typing set -- being able to hit them without meta keys is more important.
(For commenting out large swathes of code, the above makes it impossible to use the numeric keypad to quickly add in /* or */. I've taken to using Edit.CommentSelection and Edit.UncommentSelection instead, or Visual Assist's comment selection facility. These have the additional slight advantage of not producing unnestable comments.)
Only other particularly useful shortcuts I find myself stuck without are these two:
Ctrl+Alt+1 for View.FindResults1
Ctrl+Alt+2 for View.FindResults2
The other lesser windows have keyboard shortcuts for them by default; I'm not sure why the Find Results windows don't.
I don't generally remap much (probably due to having to wander around and help others who have default mappings often), but there are two additions / changes I like to make:
Alt+N becomes VAssistX -> Refactor -> Rename... for Visual Assist X (VAssistX.RefactorRename). More recent VAX copies make this Shift+Alt+R automatically, but we were on a version without a keybinding for this, and I became accustomed to Alt+N.
F7 changes to do a Build -> Project Only -> Build Only Project (Build.BuildOnlyProject); Ctrl+Shift+B still builds the solution. Not sure if I'm married to this or not, but I do wish there was a default keyboard shortcut for BuildOnlyProject. Since we're using an external make, Ctrl+F7 (Build.Compile) for a single file doesn't work for us, and I forget it exists half the time when working with other projects.
If you'll allow me to continue to gush over a commercial product, my favorite shortcuts are still VAX's Alt+Shift+S find symbol, Alt+Shift+O open file in solution, and Alt+O open corresponding file. But those are not remappings, they're defaults...
Ctrl+1 - Resharper.UnitTest_ContextRun (Run unit test at cursor position)
Ctrl+2 - Resharper.UnitTest_ContextDebug (Debug unit test at cursor position)
http://www.viemu.com/
It tries very hard to accurately emulate vim. Intellisense and all other features of VS still work perfectly (unlike with all the free vi[m] plugins).
The developer is very friendly and has a very fast turnaround time for feature requests.
I can't use VS without this plugin as a long long time vim user.
ALT+W+U : Hide all tool windows like Watch, Immediate, Output etc. Useful when you wanna focus on the code you're writing

How can I navigate backwards in Xcode?

In Visual Studio I can navigate backwards by pressing Ctrl + -. This is very useful when checking out the definition of a function and then immediately going back to the code I was working on.
How can I do this in Xcode? (I'm using version 3.1.2)
* Writing this if people using Xcode 4 need the answer for their versions:
In Xcode 4 preferences, it's configured to be ^ + ⌘ + ← (control-command-left arrow) to navigate back and ^ + ⌘ + → (control-command-right arrow) to navigate forwards.
Xcode 3.1.x is admittedly a bit weak in this respect. Happily, the navigation #zoul mentions (The back/forward arrows in the header bar, or ⌘⌥← and ⌘⌥→) is significantly improved in Snow Leopard, and should provide the finer-grained navigation you're hoping for. Sorry there's not an immediate solution, but hopefully it helps to know that a fix is coming...
There’s a Cmd + Alt + ← that goes back in editor history, and conversely Cmd + Alt + → that browses forward. (Not sure if this is exactly what you are looking for.) It goes well with Cmd + Alt + ↑ that switches between the header and the implementation file.
There are small arrows on top left corner of editor pane in Xcode.
On Macs with multitouch trackpads, you can also use three-finger-swipe left and right to navigate through the file history.
Also re: MrDatabase's comments on stefanB's response, if you've been actually jumping from definition to definition (by, for instance, holding down Command and clicking on a symbol) as opposed to just scrolling, I believe that the file history should track navigation even within the same file... perhaps that was a change in Xcode 3.1.3.
Control + Command + Arrow keys work for me.
Other than the 'complete shortcut list', I don't know.
You can find previous with ⇧⌘G, but that's not really what you were after I think.
In Xcode 13.0.0 you can use:
(OS: Mac 11.6)
Control + Command + → or ←
Hope this help!

What is this "go forward/backward" thing? ........and file switching

You know in Xcode, you can press option - command - left/right arrows to switch between multiple files. But what are these files?
They seem to be the ones that have been opened. But is there any way to check what they are? And close some unwanted ones.
Or, any other way you know to switch between files??
alt text http://img19.imageshack.us/img19/8724/picture4asx.png
if you click on untitled.m it will bring up the 'history' although it really functions more like multiple open documents per window.
The 2 arrows to the left of it are equivalent to the command+option+arrow
command+shift+W will close the current open document and open the most recent
I dearly miss ctrl+tab for recent document list like in Visual Studio, Eclipse and others. They do it with the application switcher so why not in their editors ? And whats up with "Command + Option + Shift + T" shortcuts ? One thing I have noticed after switching to Mac is the use of lame shortcuts like that, "press cmd+ctrl+option+]+k to open bla bla". Have Apple developers 4 hands or something ? If I want to indent multiple lines it should have been just tab.
Apple and 3rd party developers doesn't seem to follow a standard like they do in the windows world, every app has its own way of doing things.
Your guess about
They seem to be the ones that have
been opened
is correct.
Here is some ways you can use to switch between files.
^1 popups loaded files
Command + Option + Up to switch between declaration and implementation files.
Command + Shift + D to quick open project related file.
Command + Option + Shift + T to reveal your file in the group list. And then select related one.
"Popup of include files" is also good one to browse files related to the current one.
"View -> Smart Groups -> All Files | Symbols | etc " and then Tab and type first letters. Tab. And choose one you want. Bind some keys for that.
Simpliest: Two finger swiping on the trackpad left-and-right.
Command + Option + left / right arrows - collapse code
Command + Ctrl + up / down arrows - switch between .h and .m
Command + Ctrl + left / right arrows - move backward / forward

What are your most frequently used shortcut keys in visual studio? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
Recently , I found some shortcut key really helpful which I never used before .
Such keys like F7 ,F3 ,Ctrl+g help me a lot when editing and debuging.
What are your most frequently used shortcut keys in visual studio?
including Resharper's shortcuts:
Ctrl-Shift-B (build)
F12 (go to definition)
Shift-F12 (find usages)
Ctrl-- (go to last location)
Alt-Shift-L (go to current file in the solution explorer)
Alt-\ (find member)
Ctrl-T (find type)
Ctrl-Shift-T (find file)
Shift-Esc (close current dialog)
Ctrl-Shift-S (save all files - VS tends to forget)
EDIT: added explanations
I always use the debugging keyboard shortcuts - F9 (toggle breakpoint), F10 (step over) and F11 (step into). I can't believe that some of my coworkers actually use the toolbar buttons for this - it's insanely more efficient to use the shortcuts.
Standard VS keys of F12 for going to the definition and then CTRL+- to go back to where I was before that.
Probably the two shortcuts that get me around VS and my code quicker than any other.
Ctrl + . for bringing up the smart tag for adding namespaces, renaming/refactoring, etc.
I also remapped Ctrl + B to build, Ctrl + Shift + P to Build Selection (in a sense, Build Project) and Ctrl + W to close window.
CTRL+K CTRL+C for comment selection and CTRL+K CTRL+U for uncomment selection (They may be mapped to CTRL+E CTRL+C and CTRL+E CTRL+C in some standard keyboard mappings, but the first two will generally still work...)
The most used keyboard shortcut is Ctrl-Tab to switch between tabs.
Another one I use alot is Ctrl-I to start incremental search.
Two more:
Alt+Ctrl+C for Call Stack
Alt+Ctrl+I for Immidiate window
(Both helpful while debugging)
The list is endless. To maximize readble code space, I've removed all my toolbars. If I want to do it, I have to know the keyboard shortcut for it.
Aside from the basics, I constantly use things like Ctrl-M,O, Ctrl-K,C, Ctrl-K,U, Ctrl-K,D, Ctrl-Alt-E, Ctrl-Alt-P. I have also made a little smiley-face button for "Remove and Sort Usings" because navigating through the right-click menu takes too long and it doesn't have a hotkey that I know of.
Ctrl+Shift+F9 to delete all the break points in a solution. Very handy when people leave them spattered all over the solution!
Shift + F6 to build current project, Shift +F5 to stop debugging
I use many, but most useful I think is
CTRL+K Kfor setting a bookmark
and CTRL+K N for going to next bookmark and CTRL+K P for previous
CTRL+D and then ">of $filename" (open filename),
CTRL+K+C (comment selection),
CTRL+K+F (format),
CTRL+X and CTRL+C on a line to cut
or copy the entire line
I use the bookmark shortcuts alot: Ctrl-K Ctrl-K to create a bookmark, Ctrl-K Ctrl-N to cycle through them.
Ctrl-Shift-B to build is probably the most executed though.
Ctrl + B
which for me is build current project.
I use it less in VS2008 SP1 with the error highlighting so
Ctrl + D
which for me is Go To Definition is starting to edge it out.
I never can remember shortcuts, but Ctrl + - . is one of the few I can remember and use often. With Resharper installed, Alt + Enter is Ctrl . on steroids. Both intelligently resolve a variety of errors or refactorings.

Resources