Did you know… How to navigate forward and backwards in the editor all because of go back markers? – #041


In the standard toolbar, there’s the Navigate Backward and Navigate Forward buttons.

Navigate Forward and Navigate Backward standard toolbar buttons

In the editor, the Navigate Backward is bound to Ctrl+minus and Navigate Forward is bound to Ctrl+Shift+minus.  I find these commands most helpful when navigating amount multiple files or jumping around through callstacks.

That’s the basic editor navigation 101 course.  Now time for the advanced course.

You may have noticed that the Navigate Backward button additionally contains a drop down listbox.  This will show you all the places that have a “go-back marker.”  In other words, when you hit navigate backward, you are going to the most-recently visited go-back marker.

If we’ve done our jobs right, the go-back navigation should feel natural.  But if you are like me, you like to know the little ins-and-outs of how things work.

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

  • Incremental search (including reverse) leaves a go-back marker at beginning of search and another one at the end
  • A GoToLine or a Mouse-click that moves the cursor 10+ lines from current position (so 11 lines and more) drops a go-back marker at new location
  • A destructive action (after having moved the cursor to a new location) drops a go-back marker
  • Doing a Find (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

If you’ve found a condition where you’d like to see a go-back marker dropped, let me know.

Technorati tags: VS2005Tip, VS2008Tip

Comments (18)

  1. Matt Casto says:

    I have a Microsoft Natural Ergonomic Keyboard 4000 which has a built in Back and Forward button.  These buttons automatically activate the Navigate Backward and Navigate Forward features in Visual Studio, which is really handy!  I’m not sure, because I don’t have one of these atm, but I’d assume any mouse with a back/forward button might do the same.

    Now, if I could just figure out a nice way to use the zoom slider in Visual Studio.

  2. sean says:

    Any idea if there’s a way to drop these markers using the VS SDK?

  3. Ben says:

    Yay!!!  I wanted to navigate forward and backword for so long and didn’t know how….

    (Been using Visual studio for about year now.)

    So here’s big thank you from me!!

  4. Rory Becker says:

    This should also work on a 5-button mouse.

    Left-side button = go back and Right-ride button = go forward… Just like in your browser.

    More useful than the wheel on your wheel mouse.

    Of course I have a 5 button wheel mouse so it’s all good 🙂

  5. Kim says:

    Great blog!

    I would like to see visual indications of the nav drops. ie. a small colored icon or graphic. CodeRush does that with markers.

  6. droid says:

    Did YOU know the Forward and Backward work in the Keyboard&Mouse Forward and Backward buttons… BUT only if you selected C# IDE settings. Atleast in Beta 2.

    I filed a bug that I’d like it to work in C++/general settings too but it was closed. This is a problem because you cannot set them to work in mouse or keyboard through the shortcut settings in VS since they don’t recognize the mouse or keyboard "extra" buttons. What mouse or keyboard these days doesn’t have forward/backward button? None! So they should be recognized by VS.

  7. In a previous tip, we learned more than we ever wanted to know about go-back markers . Insertion points

  8. After yesterday’s tip on how Navigate Forward, Navigate Backward, and go-back markers work, did you know

  9. In a previous tip, we learned more than we ever wanted to know about go-back markers . Insertion points

  10. 昨日のワンポイント では [戻る] ボタンと [次に進む] ボタン、および移動マーカーについてご紹介しましたが、テキストを最後の移動マーカーまで選択する方法はご存知でしたか?これは Ctrl + 等号

  11. 標準のツール バーには、[戻る] ボタンと [次に進む] ボタンがあります。 エディタでは、[戻る] は Ctrl + マイナス ( – ) キーに、[次に進む] は Ctrl + Shift + マイナス

  12. 以前のワンポイントでは、 移動マーカー について、期待以上の内容を学べました。挿入ポイントは少しだけ違っています。これは移動マーカーと似ていますが、マウスをクリックしたりカーソルを移動したりした先の任意の位置を示します。移動マーカーの

  13. В стандартной панели инструментов имеются кнопки навигации: "Вперед" и "Вернуться"

  14. В стандартной панели инструментов имеются кнопки навигации: "Вперед" и "Вернуться"

  15. Ho aggiunto un punto esclamativo perché questo non l’ho mai saputo. è incredibile che io trovi ancora

  16. update 2 dec 2008 : This feature originated in C++ over 10 years ago. My bad C++ folks for my earlier