Navigate Backward and Navigate Forward

Tips Search

Navigate Backward and Navigate Forward

  • Comments 6

Keyboard:  CTRL + -; CTRL + SHIFT + - 
Menu:  View -> Navigate Backward; View -> Navigate Forward
Command:  View.NavigateBackward; View.NavigateForward
Versions:  2008,2010
Published:  3/1/2010
Code:  vstipEdit0024

 

image

 

The editor remembers locations when you move in a single command more than several lines away from where you are currently working, or if you edit in a particular location that is not adjacent to the last place you edited.

 

The goal is to remember interesting locations so that you can recall where you have been working without remembering so many locations the feature is not useful (such as every character typed, or every line entering several new lines of code one right after the other).

 

A go-back marker is dropped under the following conditions:

  • An incremental search (including reverse) leaves a go-back marker at the beginning of the search and another one at the end.

  • A Go To Line action, like CTRL + G, or a mouse-click that moves the cursor 11 lines or more from the current position drops a go-back marker at the new location.

  • A destructive action (like hitting Backspace) after having moved the cursor to a new location drops a go-back marker.

  • Doing a search, like Ctrl+F, drops a go-back marker at the found location.

  • Opening a file drops a go-back marker wherever the cursor was on the old file and drops another on the opened file.

 

So with all that, welcome back to the wonderful world of the Navigate buttons (and keyboard shortcuts, too)!  These gems make travelling around your code much, much easier:

image

  • Thank you, now I understand the logic behind the navigate Forward/backward better.

  • Why don't you leave a go-back marker when a file is closed  also? the same way you do when you open a file

    (Opening a file drops a go-back marker wherever the cursor was on the old file and drops another on the opened file.)

    That way someone could hit CTRL + (-) and open the file in the exact position he was when he closed it.

    Is there a way to do this manually.

  • Andreas,

    Sadly all the go back markers in a file are removed when the file is closed so this isn't possible by any means I know of.

    Z

  • Why not use the more standard ctrl-left/right?

  • The incremental search appears to pollute the navigation history with the intermediate and irrelevant partial matches too. When I jump from one part of the code to another by search term, then try to return to my original code location, it steps back through all the partials. The blog entry suggests that it works how I'd expect it to work (just leaving one at the very start and the very end of the search), but it doesn't seem to. As a work-around, setting temporary bookmarks almost works faster to return to the previous location.

  • Dwayne,

    Remember the rules for go back markers are additive so if ANY of the rules are met it will drop a marker.  That could be what is happening in your case.

    Z

Page 1 of 1 (6 items)
Leave a Comment
  • Please add 2 and 5 and type the answer here:
  • Post