Friday, June 06, 2008

Productivity with key cords

You can assign keyboard short-cuts to start menu items in Windows. Visual Studio allows you to map every known command to keyboard shortcuts. This can be a major help for those programs and commands that you use often. My philosophy is that the keyboard (and thus the keys) are always in the same place (very helpful when you have multiple monitors and a lot of ground to cover with a mouse cursor). Even when mousing, my left hand is always on the keyboard so many of my most frequently used shortcuts are left-hand-only. It's amazing how easy it is and how much time it can save.

Below are my favorites. Each is preceded with an indicator of where the shortcut is defined ([W]dows or [V]isual [S]tudio). Some of the Visual Studio cords are more applicable for web application development.

W: Ctrl-Alt-S
Launch source control. (Probably only useful for you if you use a explorer type utility for you particular source control system such as VSS or Vault.)

W: Ctrl-Alt-Shift-S
Launch SQL Server management studio.

W: Ctrl-Alt-D
Launch Windows command shell.

W: Ctrl-Alt-Shift-P
Launch Windows PowerShell.

W: Ctrl-Alt-F
Launch Firefox.

W: Ctrl-Alt-C
Launch Beyond Compare, my favorite comparison tool.

W: Ctrl-Alt-E
Launch Internet Explorer.

W: Ctrl-Alt-X
Launch Microsoft Excel.

W: Ctrl-Alt-M
Launch mail app (Outlook in my case).

W: Ctrl-Alt-V
Launch Visual Studio 2005.

W: Ctrl-Alt-Shift-V
Launch Visual Studio 2008.

W: Ctrl-Alt-O
Launch Opera.

W: Ctrl-Alt-P
Launch PasswordSafe (password management tool).

VS: Ctrl-Alt-Shift-A
Attach to processes. I use this to manually attach to running processes instead of always launching apps using "Run" which starts the browser and attaches to the server and browser. Usually I just run web apps in an active browser and attach as needed. 9 out of 10 times the problems in the code are obvious and I don't need to actually step through code. Plus, when you have a web app that loads up session variables, requires logins, etc. it's far easier to just dive into debugging then to have to re-launch and go thru all the steps to reproduce a problem.

VS: Ctrl-Alt-Shift-D
Detach from all processes.

VS: Ctrl-Alt-B
Build solution

VS: F6
Build the active project. Very handy for when you are fixing simple compile time errors. If I have a project with many errors that I'm working on, I will quite often just rebuild with this instead of hunting for the collapsed error list as I work my way through the errors.

VS: Ctrl-Alt-B (VS default shortcut)
Build solution

VS: Ctrl-Alt-Shift-B
Re-build solution. For me, this one does require two hands. But I use it less often as "Build solution" and my right hand is usually on the keyboard already.

VS: Ctrl-Alt-Shift-C
Show differences between working file and source controlled copy. (This VS command only works when the focus is on the solution explorer). However, that is only a matter of the next shortcut.

VS: Ctrl-Alt-L
Move focus to the solution explorer. You can move back and forth between the solution explorer and the active code editing window with this and ESC.

VS: Ctrl-Alt-Shift-H
Show file history in source control.

VS: Ctrl-Shift-F4
Close all documents.

The one catch with using shortcuts is that you have to avoid overlap. You can't set up a short cut in a particular application that is the same as one used in Windows, as Windows will catch it first. That's why I have some commands modified with the Shift key, such as the process detach short cut that would otherwise conflict with launching a command shell.

Aside from these, I also use some of the standard built in Windows short-cuts:
WinKey-E: Windows Explorer
WinKey-R: Start -> Run
WinKey-M: Minimize all windows
Ctrl-Shift-ESC: Task manager

Overall, once you start using keyboard shortcuts you'll find it far easier and faster to execute tasks. People often comment on how fast I am when working. It's not so much that I'm faster than them, I just use the apps and tools in a more efficient way. We all have enough work to do, there's no reason to make it harder by wasting time hunting for programs and commands that we use all the times.

No comments: