Best solutions for quickly browsing between open files/methods in VS?

Started by
5 comments, last by skytiger 13 years, 4 months ago
Hi,

My project now includes several written libraries, many code files, and even more methods/classes. I often work on one class, and a specific method in it, and then need another, and then another. This leads to many files being open in the tabs above, one more each time I open a new one. That is good for working back and forth between 7 or 8 files but often within half an hour I will need more than that. So then I have to close and use the solution browser to find the class (file) or the object browser to find the method. I have many folders and files and classes to browse through so this is a strain on the eyes and takes a lot of time.

-Bookmarks: I used bookmarks for a while but then the list would get pretty full and I'd usually use one bookmark only a few times before moving on. Then some, I would delete and need them later, so I stopped deleting them, and I ended up with a big list which is almost the same like using the object browser except it isn't ordered in any particular way.

-"Go to definition": so now, I bookmark some of the entry points for my code and then from there I keep right-clicking and then "Go to definition" (I'm using .Net btw) to get me to the method I want to get to. This is somewhat quicker, but getting back usually takes some scrolling and clicking. I can't believe there isn't a "<- Back" button that will take me back to where I was before the jump? That would be very useful.

I've been browsing the menus, and the huge list of Commands, but can't quite get the answers to this:
Is there a way to have more code files open in the tabs?
Is there a way to make groups of bookmarks?

I'm sure I'm doing something wrong, and that there is a better way. Would the more experienced users please share their methods of browsing through files, or at least tell me that my ways are as quick as it gets? That would help a lot, thanks.
Advertisement
I'm not sure what language your project is in, but Resharper adds a few more navigational commands for C#.
What version of VS? Not sure about 2005, but in 2008 and 2010 there is definitely a back button (command is NavigateBackward, it's usually beside the undo buttons on the toolbar and the default hotkey is Ctrl+-)

As for other navigation, a combination of F12 (go to definition), ctrl-tab (switch files), and the occasional alt-w-l (close all windows) usually keeps me flowing nicely. Learn the kb shortcuts in VS and you'll find you can navigate quite elegantly.
if you think programming is like sex, you probably haven't done much of either.-------------- - capn_midnight
Well, there is Visual Assist X and ViEmu to the rescue for some of that. But there is stuff built in.

You can always jump-to-definition with VS F12, VAX Alt-G, ViEmu Ctrl-]
You can navigate backwards through bookmarks and jump-definitions with VS ctrl-minus, or ViEmu Ctrl-o
You can always open tabs and vertical or horizontal split the view to see two at once.
ViEmu supports vim's "marks". m followed by a-z,A-Z,0-9 drops a named mark. ' followed by that name takes you back to the mark. But, this only works to jump around a single file.
VAX supports a jump-to-file dialog alt-shift-o. This gives you a dialog that does incremental search as you type to locate the file you want.
VAX supports a jump-to-method dialog (idk the normal keys). This give you the same incremental search dialog, but lists methods in the current file.
VAX supports a swap-to-header alt-o, to quickly go between paired files.

VS also supports "folding". (How I wish it worked as well as Vim's folding...) You can always fold up scopes in the file to be able to see more stuff at once.
Thanks for the replies!

Yes I'm using VS 2008, and Reshaper when working in C# (sometimes I work in VB) I should have mentioned.

@ChaosEngine
It seems I changed my layout a while back and I didn't have the Navigate Backwards. I now tried it out using ctrl+"-" and it works! :) That is just awesome, thanks so much. I use F12 sometimes too, but now with the "backwards" option, it'll be much more useful.

@KulSeran
I am now in the process of downloading VAX. The jumping sounds like exactly what I need. I'm sort of puzzled that I didn't think about googling for VS addons like that one before. Oh well, thanks a bunch!
I find that adding the following hotkey mappings drastically improves navigation in stock VS:

ALT+Z: View.NavigateBackward
ALT+X: View.NavigateForward

ALT+Q: Edit.GoToDefinition
ALT+A: Edit.FindAllReferences

ALT+S: View.ShowSmartTag (this is the context-sensitive drop-down thing that has "add using", "implement interface", etc)


With VAX installed, I also unmap the ALT+F key from the File menu so that I can use it for VAX's "Open File in Solution" dialog.
its an annoying design flaw - common to many microsoft products

the reason it is stupid and thoughtless is:

if you look at the tabs - file may not be visible even if open

if you look in the windows dialog - file might not be open

if you look in the solution explorer - you will always find the file - but you may have to scroll up and down etc.

same goes for the class view

I often work on a related set of files (from multiple projects) at the same time
what I would give to just create sets and quickly switch between them, open or not

microsoft might figure out how to design a ui properly, in another 20 years

win7 kind of fixes a similar problem with the whole idiotic start menu / programs / task bar mess

(I just can't believe how low quality their output is as a company)

This topic is closed to new replies.

Advertisement