Wednesday, June 29, 2011

Navigation bar in Visual Studio

There are several ways you can navigate the code in Visual Studio.

  • Ctrl and Ctrl Shift to navigate back and forth of places you clicked.
  • Bookmarks, you can tag some specific locations and cycle through those book marks using Ctrl K Ctrl N and Ctrl K Ctrl P
  • Ctrl , Navigate to dialog lets you search members across class, project and solution.
  • Ctrl F lets you do simple search on current document and Ctrl Shift F lets you search in Current Project or in entire solution.
  • Navigation bar on top of the text editor lets you navigate the classes in the current document and members in current class.
    image

One of the top features of Visual Studio is, its keyboard bindings. Most of the things you do with your mouse can be done via keyboard. I have been looking  for keyboard shortcut to do this. I posted a question in Stack Overflow hoping to find some answers. Few people suggested Macros in Visual Studio. But its doesnt help. Macro Recorder doesn't recognize mouse clicks and key strokes. Today I started looking again. I googled this link that gave me the answer I have been looking for. Ctrl F2 changes the focus to Navigation bar. Ctrl F2 Tab changes the focus members dropdown list. There are two things I don't like with this approach.

  1. It uses wired key combination Ctrl F2 at lease for me
  2. Ctrl F2 TAB resets the members dropdown list selection. Using Shift TAB fixed this automatic resetting.

Still its too many awkward key strokes. So I wrote a small AutoHotKey script to do this with Ctrl Shift G

0 Comments :