views:

161

answers:

6

Stack Overflow has covered favorite short-cuts and add-ins, optimizations and preferences -- great topics all. If this one has been covered, I can't find it -- so thanks in advance for the link.

What are your favorite Visual Studio keyboard remappings?

Mine are motivated by the fact that I'm a touch-typist. Mouse, function keys, arrow keys, Home, End -- bleh. These are commands I do all day every day, so I've remapped them to sequences I can execute without moving my hands from the home row.

The command that is remapped in Tools => Customize => [Keyboard] is shown in parentheses.

I'm 100% positive that there are better remappings than these, so please post yours! Please include the command; oft times, figuring it out is a challenge.

-- Hoytster

Running the app and operating the debugger

Ctrl+Q + Ctrl+R Run the application, in debug mode (Debug.Start)

Ctrl+Q + Ctrl+Q Quit (stop) the application (Debug.StopDebugging)

Ctrl+T Toggle a breakpoint at the current line (Debug.ToggleBreakpoint)

Ctrl+K + Ctrl+I Step Into the method (Debug.StepInto)

Ctrl+K + Ctrl+O Step Out of the method (Debug.StepOut)

Ctrl+N Step over the method to the Next statement (Debug.StepOver)

Ctrl+K + Ctrl+H Run the code, stopping Here at the cursor position (Debug.RunToCursor)

Ctrl+K + Ctrl+E Set then next statement to Execute (Debug.SetNextStatement)

Navigating the code

Ctrl+S Move a character LEFT (Edit.CharLeft)

Ctrl+D Move a character RIGHT (Edit.CharRight)

Ctrl+Q + Ctrl+S Move to the LEFT END of the current line (Edit.LineStart)

Ctrl+Q + Ctrl+D Move to the RIGHT END of the current line (Edit.LineEnd)

Ctrl+E Move a line UP (Edit.LineUp)

Ctrl+X Move a line DOWN (Edit.LineDown)

Ctrl+K + Ctrl+K Toggle (add or remove) bookmark (Edit.ToggleBookmark)

Ctrl+K + Ctrl+N Move to the NEXT bookmark (Edit.NextBookmark)

Ctrl+K + Ctrl+P Move to the PREVIOUS bookmark (Edit.PreviousBookmark)

Ctrl+Q + Ctrl+W Save all modified Windows (File.SaveAll)

Ctrl+L Find the NEXT instance of the search string (Edit.FindNext)

Ctrl+K + Ctrl+L Find the PREVIOUS instance of the search string (Edit.FindPrevious)

Ctrl+Q + Ctrl+L Drop down the list of open files (Window.ShowEzMDIFileList)

The last sequence is like clicking the downward-facing triangle in the upper-right corner of the code editor window. VS will display a list of all the open windows. You can select from the list by typing the file name; the matching file will be selected as you type. Pause for a second and resume typing, and the matching process starts over, so you can select a different file. Nice, VS Team. The key takes you to the tab for the selected file.

OK, it's a community wiki; edit away. :)

A: 

I don't generally remap much (probably due to having to wander around and help others who have default mappings often), but there are two additions / changes I like to make:

  • Alt+N becomes VAssistX -> Refactor -> Rename... for Visual Assist X (VAssistX.RefactorRename). More recent VAX copies make this Shift+Alt+R automatically, but we were on a version without a keybinding for this, and I became accustomed to Alt+N.
  • F7 changes to do a Build -> Project Only -> Build Only Project (Build.BuildOnlyProject); Ctrl+Shift+B still builds the solution. Not sure if I'm married to this or not, but I do wish there was a default keyboard shortcut for BuildOnlyProject. Since we're using an external make, Ctrl+F7 (Build.Compile) for a single file doesn't work for us, and I forget it exists half the time when working with other projects.

If you'll allow me to continue to gush over a commercial product, my favorite shortcuts are still VAX's Alt+Shift+S find symbol, Alt+Shift+O open file in solution, and Alt+O open corresponding file. But those are not remappings, they're defaults...

leander
I didn't know about those F7 build variants; I've been wasting time! Thanks, Leander.
hoytster
+1  A: 

For editing and rearranging I've found the following 3 very useful, even though they're not on the home row:

  • Keypad + for Edit.Copy

  • Keypad - for Edit.Cut

  • Keypad * for Edit.Paste

These are easy to hit (even with the right thumb, at a pinch, if your right hand is holding the mouse) and require no meta keys. I often work by writing snippets then turning it into compilable code using search and replace, and then copying in words from elsewhere. The second step is usually most efficiently done by using the cursor with the mouse, so I've not found it a problem that these keys are so far away from the typing set -- being able to hit them without meta keys is more important.

(For commenting out large swathes of code, the above makes it impossible to use the numeric keypad to quickly add in /* or */. I've taken to using Edit.CommentSelection and Edit.UncommentSelection instead, or Visual Assist's comment selection facility. These have the additional slight advantage of not producing unnestable comments.)

Only other particularly useful shortcuts I find myself stuck without are these two:

  • Ctrl+Alt+1 for View.FindResults1
  • Ctrl+Alt+2 for View.FindResults2

The other lesser windows have keyboard shortcuts for them by default; I'm not sure why the Find Results windows don't.

brone
I adopted your FindResultsX short-cuts, thanks! It's surprisingly comfortable and easy, to press my ThinkPad's right alt-key with my right thumb. So many more possibilities! I don't have a numeric keypad.
hoytster
A: 
  • Ctrl+1 - Resharper.UnitTest_ContextRun (Run unit test at cursor position)

  • Ctrl+2 - Resharper.UnitTest_ContextDebug (Debug unit test at cursor position)

adrianm
I am supposed to be learning TDD, and was unaware of Resharper's TDD features. Excellent, thank-you!
hoytster
A: 

http://www.viemu.com/

It tries very hard to accurately emulate vim. Intellisense and all other features of VS still work perfectly (unlike with all the free vi[m] plugins).

The developer is very friendly and has a very fast turnaround time for feature requests.

I can't use VS without this plugin as a long long time vim user.

Bob
A: 

ALT+W+U : Hide all tool windows like Watch, Immediate, Output etc. Useful when you wanna focus on the code you're writing

Alper
A: 

Tools -> Options -> Keyboard -> Apply the following additional keyboard mapping scheme -> Emacs

Ray Vega