views:

30

answers:

1

Is there any short-cut or device in Visual Studio to let me quickly get focus on the file I am editing?

I often meet the scenario: after I edit a specific c# file for a while, I suddenly want to search for other files in the same directory hierarchy.

+1  A: 

Pressing F7 will set the focus on the code editor.

You can download a cheat sheet with all the shortcuts from MSDN (mostly for English keyboard layouts):

Or you can create your own cheat sheet (including all your customizations) using a macro:

Creating Visual Studio Keyboard Shortcuts Cheat Sheet

0xA3
Hi divo,Pressing F7 just switches back and forth between Source and Design view, doesn't it?
Ricky
Well, with the default C# settings in VS 2008 `F7` is bound to the `View.ViewCode` command which displays the code and sets the focus to the editor window.
0xA3
All right. What I originally mean is to get the focus on the file in "Solution Explorer", which is being edited. :P
Ricky
Ok, then why didn't you ask that ;-) Just press `Ctrl+W, S` (on an English VS. Btw, that shortcut is also displayed in the `View` menu).
0xA3
Hi, it seems not working for me: it'll just save the file (English VS). And I didn't see it view menu. Do you know the command name in keyword in options -> Envir -> keyword?By the way, I often scoll up/down, collapse directories in "Solution Explorer" while I am editing a file so that I frequently forget which file I was in.
Ricky
You must press the `Ctrl+W, S` shortcut the following way: Press and hold `Ctrl`, then press `W`. Keep `Ctrl` still pressed and press `S`. That's how all those double-shortcuts work in VS.
0xA3
Hi divo, I found that the "View.SolutionExplorer" turns into Ctrl+Alt+L somehow in my VS. This cannot fully satisfy my need; as you collapse the folder or scroll up/down leaving the edited file out of sight, "Ctrl+Alt+L" doesn't work - it will not automatically focus on the edited file, doesn't it?
Ricky
If you are not comfortable using keyboard shortcuts you might better better off using the mouse.
0xA3
I'm finding ways to improve my productivity :P
Ricky