xcodeidexcode5hotkeys

XCode 5 -- Jump To Previous Cursor Location


I would like to jump to the previous cursor position within a file in XCode 5 (with either a keyboard hotkey or a drop-down menu path).

This SO post worked for XCode 3: Does XCode have a cursor navigation stack like Visual Studio?

But for XCode 5, I could not find this functionality here: http://cloud.github.com/downloads/Machx/Xcode-Keyboard-Shortcuts/Xcode_Shortcuts.pdf, nor in the Apple Documentation here: https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/xcode_help-command_shortcuts/Introduction/Introduction.html#//apple_ref/doc/uid/TP40010560-CH1-SW1

EDIT

Sorry I wasn't clear earlier. I do not want to switch between files. As the answers below state, that is what ctrl+cmd+left/right does. I want to switch between cursor positions within a file. For example:

I am working in MyViewController.m.

I write a function -(void)doStuff at line 178.

In -(void)doStuff, I realize that I need to update an @property to be readwrite.

I go to the top of MyViewController.m to line 10. I add the line @property (nonatomic, strong, readwrite) NSMutableArray *myArray;

Now I want to return to finish writing my -(void)doStuff method. What is the best way to get there? This is when I'd like to say "Go to the last text cursor position."


Solution

  • A useful trick I found is to bind opening the Document Items menu (by default Ctrl + 6) to something easier to type for me. Then when I'm about to, say, jump to some method definition (that may or may not be in the same file I'm already in), I first open the Document Items menu then just hit Enter. That marks my current location in the navigation stack. It also marks the line the cursor is at in the current method, too.

    enter image description here

    It takes a little training to remember to mark your place, but being able to open that menu and hit Enter quickly from the keyboard makes it less painful to force Xcode to mark your navigation within a single file.