Share via


VS 2003 Tip #6: Keyboard shortcuts

I'm a keyboard shortcut junkie. I love keyboard shortcuts for tasks. I've been known when speaking to devs to say stuff like “Ctrl+alt+l, Select foo.cpp, Ctrl+alt_w+1...no, hit Ctrl+alt...” instead of “ Open the solution explorer, select Foo.cpp, open a watch window...”. A while ago I saw a post where Jason Mauss asked for the keyboard shortcuts to VS.

However, there are some that I find so useful that I thought I would call them out here (note I tend to use the Visual Studio developer profile in Everett. You can change this from Help->Show Start Page and then pick the My Profile tab):

  • Word wrap. I hate scrolling across the screen to see a really long line of code. Hit Ctrl+R, Ctrl+R instead. Voila - instant word wrap. Hit it again to unwrap. This also works in the output window.
  • Copy and then cut the current line of code. Oftentimes, you want to move the current line of code you are working on a couple of lines down. Hit Ctrl+C, C. That copies the current line. Hit Ctrl+L to delete the current line of code. Move your cursor down and hit Ctrl+V. That should paste your original line of code.
  • After a build failure hit F8.  F8 takes you through your errors one by one, and highlights them in the code and puts the message in the status bar at the bottom of VS.
  • Comment and uncomment code quickly. Select your code. Hit Ctrl+K, Ctrl+C. Automatically commented. Select again. Hit Ctrl+K, Ctrl+U. Uncommented.
  • Auto formatting. Select your code, or hit Ctrl+A if you are lazy like me. Hit Ctrl+K, Ctrl+F. Code is formatted.
  • Incremental search. I live by this. Hit Ctrl+I and start typing out the word you want to find in the current file. The IDE then matches the word that you've typed. Hit Ctrl+I repeatedly to find the next occurence of that file. Hit Ctrl+Shift+I to go back.
  • Get Intellisense. Hit Ctrl+Space in your class etc, and you should get an intellisense dropdown that you can complete on.

Got a cool shortcut that you use frequently? Let me know. Spread the love.