Saturday, December 8, 2012

The Most Useful Visual Studio Keyboard Shortcuts

Microsoft Visual Studio is one of the best Integrated Development Environments (IDEs) available and as such it dramatically boosts the productivity of the programmers who use it. You can find many articles over the Internet that show you how to boost your productivity even more. One of the ways to do so is to take advantage of the keyboard shortcuts in Visual Studio. Unfortunately, most of the articles present hundreds of Visual Studio keyboard shortcuts, which is impossible for one to remember. Do you wonder which ones of them are the most useful and worth remembering? If yes, read on...

Take a look at the list below to see the most useful Visual Studio keyboard shortcuts professional developers use every day to boost their productivity.

  1. Editing Keyboard Shortcuts
    Alt + Left Mouse Button DragVertically selects text, you can then type the new text to replace the selected one
    Ctrl + Left ArrowMoves to previous word
    Ctrl + Right ArrowMoves to next word
    Ctrl + EnterInserts new line above the current line
    Ctrl + Left Mouse Button ClickSelects the clicked word
    Ctrl + Shift + Left ArrowSelects the previous word
    Ctrl + Shift + Right ArrowSelects the next word
    Ctrl + Shift + HomeSelects the text from the beginning of the document to the current position
    Ctrl + Shift + EndSelects the text from the current position to the end of the document
    Shift + HomeSelects the text from the start of the current line to the current position
    Shift + EndSelects the text from the current position to the end of the current line
    Shift + TabDecreases the indentation of the current line or the currently selected text
    TabIncreases the indentation of the current line or the currently selected text
  2. Find, Replace and Navigation Keyboard Shortcuts
    Ctrl + FQuick Find - lets you quickly find a string in the currently opened document
    Ctrl + HQuick Replace - lets you quickly replace one, several or all occurrences of a string in the currently opened document with another one
    Ctrl + Shift + FFind in Files - lets you find all occurrences of a given string in a set of files
    Ctrl + Shift + HReplace in Files - lets you replaces one, several or all occurrences of a string in a set of files
    Ctrl + CommaProvides search-as-you-type support for files, types and members. The search is very fast, which makes this feature invaluable for large projects. It is case sensitive if the input string contains uppercase letters and case insensitive otherwise.
    Ctrl + GNavigates to a given line number in the currently opened document
  3. Refactoring Keyboard Shortcuts
    Ctrl + DotShows a handy refactoring menu when you have renamed an identifier or you are on an identifier that requires a new "using" directive
    Ctrl + R + RAllows you to rename the element under the text caret, automatically doing all the needed refactoring
    Ctrl + UConverts the currently selected text to lower case
    Ctrl + Shift + UConverts the currently selected text to upper case
    Ctrl + E + DFormats the current document
  4. Outlining Keyboard Shortcuts
    Ctrl + M + OCollapses the document to definition (i.e. collapses regions, properties, methods, comments, etc.)
    Ctrl + M + LToggles all outlining. Press it once to expand all outlining and once more to collapse it.
    Ctrl + Shift + UConverts the currently selected text to upper case
  5. Compiling, Execution and Debugging Keyboard Shortcuts
    Ctrl + Shift + BBuilds the solution
    Ctrl + F5Starts the project without debugging
    F5Starts the project with debugging support or continues execution from the given breakpoint to the next one
    F9Toggles (inserts/removes) a break point at the current line
    F10Executes the line of code after the current break points and stops execution there
    F11Steps into the code called by the currently executing line of code

I hope you find this list useful. Do you have any other favourite Visual Studio Keyboard Shortcuts?

See also:

2 comments:

  1. Ctrl + Comma, the best and least known shortcut. :)

    ReplyDelete
    Replies
    1. That's a very useful keyboard shortcut indeed, Andrew. Thanks for sharing! It's already one of my favourites :) I have added it to the list, so that other developers can benefit, too.

      Delete