Navigate Backward and Navigate Forward

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




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:


Comments (6)

  1. ArthurZ says:

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

  2. Andreas says:

    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.

  3. zainnab says:


    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.


  4. fredv says:

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

  5. says:

    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.

  6. zainnab says:


    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.


Skip to main content