Tutorial :Favorite Visual Studio keyboard shortcuts [closed]


What is your favorite Visual Studio keyboard shortcut? I'm always up for leaving my hands on the keyboard and away from the mouse!

One per answer please.


Ctrl + - and the opposite Ctrl + Shift + -.

Move cursor back (or forwards) to the last place it was. No more scrolling back or PgUp/PgDown to find out where you were.

This switches open windows in Visual Studio:

Ctrl + tab and the opposite Ctrl + Shift + tab


For me, it's nothing to do about auto completing code, matching parenthesis or showing some fancy tool panel. Instead, it's just about letting me see the code.

With all the panels surrounding you, the area you use to actually write code becomes too small.

In this cases, Shift+Alt+Enter comes in to the rescue and gets the code window in focus in full screen mode. Hit it again, and you have all the panels back.


Incremental Search - Ctrl + I

It's basically the find dialog box without the dialog box. Just start typing what you want to search for (look at the bottom status bar location to see what you've typed). Pressing Ctrl + I again or F3 searches for the next instance. Press Escape to quit. Starting a new search by pressing Ctrl + I twice repeats the last search.


Expand Smart Tag (Resolve Menu): Ctrl + . (period)

Expands the tag that shows when you do things like rename an identifier.


Ctrl+K, Ctrl+C Comment a block

Ctrl+K, Ctrl+U Uncomment the block


Stock Visual Studio? F12 - Edit.GoToDefinition.

Having DevExpress' Refactor! installed means that Ctrl + ` is my all-time fave, though ;)


The TAB key for "snippets".

E.g. type try and then hit the tab key twice.

Results in:

try   {               }  catch (Exception)  {        throw;  }  

which you can then expand.

Full list of C# Snippets: http://msdn.microsoft.com/en-us/library/vstudio/z41h7fat.aspx


Ctrl+] for matching braces and parentheses.

Ctrl+Shift+] selects code between matching parentheses.



Good old Find In Files.


Ctrl+Space, Visual Studio gives the possible completions.


Ctrl+K, Ctrl+D // Auto-(Re)Format

See Also: Answer


Ctrl+C, Ctrl+V to duplicate the current line

Ctrl+L to delete the current line

Ctrl+F3 to search for the current selection

Ctrl+K, Ctrl+K to create a bookmark (which are useful)

Ctrl+K, Ctrl+N to go to the next bookmark

And, here is something even more interesting:
Press Ctrl+/ to put the cursor into a box where you can type commands.

For example, Pressing Ctrl+/ and type ">of ", now start typing the name of a file in your project, and it will autocomplete. This is a very fast way to open files in the current solution.


Ctrl+Shift+V paste / cycle through the clipboard ring


I like Ctrl+M, Ctrl+M. To expand/collapse the current code block.


One that I use often but not many other people do is:

Shift + Alt + F10 then Enter

If you type in a class name like Collection<string> and do not have the proper namespace import then this shortcut combination will automatically insert the import (while the carret is immediately after the '>').


An equivalent shortcut from the comments on this answer (thanks asterite!):

Ctrl + .

Much more comfortable than my original recommendation.



This hides/closes any of the 'fake window' windows in Visual Studio. This includes things like the Solution Explorer, Object Browser, Output Window, Immediate window, Unit Test Windows etc. etc. and still applies whether they're pinned, floating, dockable or tabbed.

Shortcut into a window (e.g. Ctrl + Alt + L or Ctrl + Alt + I) do what you need to do, and Shift + Esc to get rid of it. If you don't get rid of it, the only way to give it focus again is to use the same keyboard shortcut (or the mouse, which is what we're trying to avoid....)

Once you get the hang of it, it's immensely useful.

Grrr....The amount of times of hit Ctrl + F4 to close the 'window' only to see my current code window close was insane before I found this, now it only happens occasionally..


My favorite: F12 (go to definition) and Shift+F12 (find references).

The latter is useful with F8 (go to next result).

Ctrl+- and Ctrl+Shift+- are mapped to my mouse's back and forwards buttons.

Ctrl+. is useful too, especially for adding event handlers and "using" statements.


Visual Studio 2005/2008 keybinding posters:

These don't cover customizations, but they're good reference materials and definitely helpful for finding new shortcuts.

Also, a macro that dumps all the current bindings to a HTML file:



Alt+Shift+arrow keys(←,â†',â†",â†')

This allow you to select things in a block. Like you could select all of the "int" in the block and then search and replace to double for example.

**int** x = 1;  **int** y = 2;  **int** z = 3;  


Ctrl+M, O. Can collapse and expand all sections of code in a particular file.


Open and set focus in Solution Explorer: Ctrl+Alt+L


One that other editors should take up: Ctrl+C with nothing selected will copy the current line.

Most other editors will do nothing. After copying a line, pasting will place the line before the current one, even if you're in the middle of the line. Most other editors will start pasting from where you are, which is almost never what you want.

Duplicating a line is just: Hold Ctrl, press c, then v. (Ctrl+C, Ctrl+V)


CTRL+F5 (Start Without Debugging)

CTRL+SHIFT+B (Build Solution)


Here is a list that I use frequently:

Ctrl + I: for progressive search. If you don't type anything after I, and keep pressing I (holding the Ctrl key down), it will search the last item you had searched. Ctrl + Shift + I will reverse search. You might also want to use F3 (and Shift + F3) once some search string is entered.

Ctrl + K Ctrl + C: For commenting highlighted region. If nothing is highlighted, current line will be commented. Naturally, you can just hold Ctrl and press K, C in succession.

Ctrl + K Ctrl + U: For uncommenting highlighted region. Works like above.

Ctrl + /: Will take the cursor to the small search box on top. You can type ">of filename" (without the quotes) to open a file. Very useful if your project contains multiple files.

Ctrl + K Ctrl + K: Will bookmark the current line. This is useful if you want to look at some other part of code for a moment and come back to where you were.

Ctrl + K Ctrl + N: Will take you to the next bookmark, if there are more than one.

Ctrl + -: Will take the cursor to its previous location

Ctrl + Shift + -: Will take the cursor to its next location (if it exists)

Ctrl + Shift + B: Build your project

Ctrl + C: Although this does the usual copy, if nothing is highlighted, it copies the current line. Same for Ctrl + X (for cut)

Ctrl + Space: Autocomplete using IntelliSense

Ctrl + ]: Will take you to the matching brace. Works with all kinds of braces: '(', '{', '['. Useful for big blocks.

F12: Will take you to the function definition/variable definition.

Alt + P + P: Will open up project properties. Although not many use this, it useful if you want to quickly change the command line arguments to your program.

F5: To start debugging

Shift + F5: To stop debugging

While debugging, you can use Ctrl + Alt + Q to add a quick watch. Other debugging shortcuts can be found in the debug drop down menu.



run to cursor when debugging. Looked for this for ages before I found the keyboard shortcut...


If 'Favorite' is measured by how often I use it, then:

F10 : Debug.StepOver



By usage, the pair:

  • Ctrl+Enter: insert blank line above the current line.
  • Ctrl+Shift+Enter: insert blank line below the current line.


When the IntelliSense drop down is displayed, holding down Ctrl turns the list semi-transparent so you can see what is hidden behind it :)


Ctrl+Alt+P -> Attach to process


Haven't seen this one ...

Ctrl + Up

Ctrl + Down

Scrolls the window without moving the cursor.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »