Freigeben über


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

  • Anonymous
    September 18, 2007
    PingBack from http://msdnrss.thecoderblogs.com/2007/09/19/did-you-know-how-to-navigate-forward-and-backwards-in-the-editor-all-because-of-go-back-markers/

  • Anonymous
    September 19, 2007
    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.

  • Anonymous
    September 19, 2007
    Any idea if there's a way to drop these markers using the VS SDK?

  • Anonymous
    September 19, 2007
    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!!

  • Anonymous
    September 19, 2007
    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 :)

  • Anonymous
    September 19, 2007
    The comment has been removed

  • Anonymous
    September 22, 2007
    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.

  • Anonymous
    November 27, 2007
    In a previous tip, we learned more than we ever wanted to know about go-back markers . Insertion points

  • Anonymous
    January 14, 2008
    After yesterday's tip on how Navigate Forward, Navigate Backward, and go-back markers work, did you know

  • Anonymous
    January 14, 2008
    In a previous tip, we learned more than we ever wanted to know about go-back markers . Insertion points

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

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

  • Anonymous
    August 12, 2008
    The comment has been removed

  • Anonymous
    September 29, 2008
    В стандартной панели инструментов имеются кнопки навигации: "Вперед" и "Вернуться"

  • Anonymous
    September 29, 2008
    В стандартной панели инструментов имеются кнопки навигации: "Вперед" и "Вернуться"

  • Anonymous
    November 28, 2008
    Ho aggiunto un punto esclamativo perché questo non l’ho mai saputo. è incredibile che io trovi ancora

  • Anonymous
    December 02, 2008
    update 2 dec 2008 : This feature originated in C++ over 10 years ago. My bad C++ folks for my earlier

  • Anonymous
    December 09, 2008
    本篇包括tip41-tip50 http://www.watch-life.net/visual-studio/visual-studio-2008-tip-day-5.html #041、通过...