CodeRush Tip – Enhance Standard VS Navigation

How many times have you hit Ctrl+Home or Ctrl+End (to navigate to the start or end of a file), only to realize mere seconds later, that you forgot to copy something to the clipboard before you left.

Now you have to find where you were, copy the code you were after, and then jump back.

There are several ways to get back to where you were:

  • Remember some snippet of code in the vicinity of where you want to be, and use VS’s find window.
  • Remember the name of the method you were in, and navigate to it using Quick Navigation, then locate the code within the method.
  • Page Up or Down to the location of your code. Scanning whole pages of code as you go in case you miss it.
  • Reach for the mouse and use the vertical scrollbar. While many people don’t like the mouse, this does give finer grain control than Page Up and Down.
  • Remember the exact line you were on and use Goto line (Ctrl+G)
  • View.NavigateBackward (See alternatives section after summary)

Wouldn’t it be great if you’d already dropped a CodeRush Marker before you left. That way you could just hit Esc and CodeRush would bring you back to where you were. It would even arrange the view the way it was before you left and restore the selection. Then you could copy the value you needed and return to whichever end of the file you wanted to.


Actually setting this up is very simple. We’re going to use the exact same technique from when we Enhanced Studio's Find Command

  • Create a new shortcut (Details here)
  • Set key 1 to Ctrl+Home
  • Set command to MarkerDrop
  • Check the checkbox that says “after executing this command, pass shortcut to IDE for default handling
  • Set context to Focus\Documents\Source\Code Editor
  • Right Click this new shortcut
  • Select Duplicate Shortcut
  • Select the Duplicate
  • Change key 1 to Ctrl+End
  • Click Ok.

…and you’re done.


All you really need to understand having done this is that you can now visit the top or bottom of a file (via Ctrl+Home or Ctrl+End) and then easily revisit the location you came from, by hitting Esc.


There are those that will point to the built in visual studio View.NavigateBackward (Alt+Left) function. However this command is for me, somewhat less useful. It does not restore my view to how it was before. It does not restore the selection and it does not provide any kind of locator beacon to help me focus on where I was.

Now if only I could add CodeRush Markers to Notepad and Word Smile

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.