336

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.

animuson
  • 53,861
  • 28
  • 137
  • 147
Adam Neal
  • 2,147
  • 7
  • 24
  • 39
  • Same questions have been asked here : http://stackoverflow.com/questions/20507/give-me-awesome-visual-studio-keyboard-short-cuts and here : http://stackoverflow.com/questions/26452/visual-studio-2005-shortcuts – Pascal Paradis Sep 19 '08 at 03:22
  • the correct thing to do is relate these by tagging them similarly – Jeff Atwood Mar 10 '09 at 22:57
  • Is there a keyboard shortcut to scroll to the start of the next or previous function? CTRL + UP or DOWN cursor key used to do this in VB and I really miss it. – Robin Bennett Jul 27 '09 at 16:18
  • Eh, programmers and their keyboard shortcuts :) Apple proved long ago that they are usually slower than using the mouse (except for certain repeated sequences of actions), but they make you *feel* like you're going faster. That said, I'm a programmer, so I use a lot of shortcuts :) I find the toolbar buttons just fine, though, for commenting/uncommenting, navigating forward/backward, etc. Especially if your hand is already on the mouse. (An old but good reference: http://www.asktog.com/TOI/toi06KeyboardVMouse1.html.) – devuxer Sep 29 '09 at 00:37
  • 2
    I think that's a load. I am much, much faster using only the keyboard than the mouse. I in fact HATE my mouse. Sucks that it is a necessity. – Kyle Rosendo Nov 14 '09 at 14:52
  • 11
    @DanM, anything that "Apple proved" needs to be taken with a grain of salt. How is hunting for and moving the mouse to a small patch of pixels ever going to be quicker than a memorized key shortcut? Seriously, get your hand of it and back onto the keyboard ;) – Ash Jan 29 '10 at 04:32
  • @Ash, you underestimate the time it takes to recall a piece of information and the time it takes to think. The time it takes to push keys on a keyboard is less than the time it takes to move a mouse to a small patch of pixels, but the time to prepare is far more. You don't notice the passage of time while you're recalling Ctrl-Shift-Whatever, but if you get out the stopwatch, it will be there. There are exceptions to every rule, so yeah, you may be quicker using Ctrl-Z than choosing Undo from the Edit menu, but for anything you don't use 100 times a day, I bet you're slower. – devuxer Jan 29 '10 at 05:21
  • ...I found this one even more amazing: http://www.asktog.com/SunWorldColumns/S02KeyboardVMouse3.html – devuxer Jan 29 '10 at 05:27
  • @DanM, but that's just the point, muscle memory means there preparation time is virtually non-existent (any thinking is subconcious). This is what touch typing is entirely based on. I'm not a touch typer, but I can type memorized shortcut keys faster than I could verbalise what I have actually typed. In programming there are shortcuts that are less commonly used, so these can take longer to memorize, however this is where mnemonics can help. – Ash Jan 29 '10 at 06:04
  • @Ash, I don't dispute what you're saying about muscle memory, but it takes thousands of repetitions to build up muscle memory to the point that it becomes subconscious. I don't see that happening for most keyboard shortcuts, except for the ones you really use constantly (like cut, copy, paste, undo). – devuxer Jan 29 '10 at 07:27
  • 2
    @DanM, its not an all or nothing scenario. Using cursor keys to move to *arbitrary* positions in a document is silly, use the mouse. But as you get more experienced with shortcuts, keys are simply quicker for most other things. With the mouse, you're also having to deal with hand eye coordination, meaning it can be very fiddly. Suggestion: Try to focus on using keys more, for a month or so. You may find it hard going to start with, but your productivity will greatly benefit if you stick at it. But sticking at it is the key. – Ash Jan 29 '10 at 08:10
  • @Ash, maybe we're not even disagreeing. I use a number of keyboard shortcuts and cursor keys all the time. My original comment was specifically dealing with some of the obscure shortcuts people were mentioning in this thread. I don't think my productivity would "greatly improve", for example, if I used Ctrl-K Ctrl-C every time I wanted to comment a block of code. A lot of times, I'm already selecting a block of code with the mouse, so it's quite natural and easy to click the "comment" button on the toolbar (and I bet you it's faster). – devuxer Jan 29 '10 at 22:29
  • Ctrl + R + E = to create the equivalent Property of the fields. – Sravan Nov 12 '13 at 18:53

124 Answers124

227

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

gkc
  • 449
  • 6
  • 18
Glennular
  • 17,827
  • 9
  • 58
  • 77
  • This is made even better when you bind them to 'application specific' back and forward mouse buttons! – Joe Jan 21 '09 at 23:07
  • 18
    I've been looking for this forever. I used to just use Ctrl+Z Ctrl+Y. – Paul Alexander Apr 23 '09 at 19:49
  • 4
    Ctrl-Tab is a bit funny in VS for some reason - it doesn't just cycle like most apps. – Lucas Jones Jul 01 '09 at 21:28
  • 6
    @Lucas Jones, It seems to cycle like Alt-Tab in Windows. Seems normal to me. – devuxer Sep 28 '09 at 23:59
  • 4
    Pressing Ctrl + Tab once swaps between the current document and previous document, you don't even need to look at the popup window. – Ash Jan 27 '10 at 05:00
  • 3
    I often cancel cycling between application windows (Alt+Tab) by pressing Esc. Doing so while cycling through document windows (Ctrl+Tab), however, pops up Windows' start menu. That just drives me nuts. – sbi Jun 02 '10 at 10:50
  • 1
    @Lucas Jones: In VS2010, Ctrl+Tab is mapped by default to Window.NextDocumentWindowNav, which provides the "Alt+Tab"-like behavior. I've remappe Ctrl+Tab to Window.NextDocumentWindow which works similarly to the "cycling" behavior. Hope that helps! – Adam W. McKinley Jul 26 '11 at 21:48
  • The cursor positions are on the standard keyboard. I added the numeric keypad keys `Ctrl+Num+Minus` and `Ctrl+Num+Plus`. These are more intuitive than minus and shift-minus. This steals them from a design view zoom, which I never use. – goodeye Apr 01 '12 at 02:36
  • VS should allow choosing windows using `Ctrl+` like `Ctrl+1 for first window. It is possible in Firefox – shashwat Jun 27 '13 at 11:09
130

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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Pablo Marambio
  • 1,562
  • 1
  • 15
  • 29
124

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.

Jasper
  • 2,166
  • 4
  • 30
  • 50
Dara Kong
  • 1,198
  • 2
  • 13
  • 11
  • Plus, it finds the first instance as you type. Ctrl-i after you hit a match searches to the next instance - and keeps you in search mode (which means you can add or change the search string). The search box is for suckers! – Aardvark Oct 04 '08 at 19:59
  • That's cool, I didn't know that, although I had on some occasions hit ctrl+I by mistake and wondered what the odd mouse pointer meant. :) – pipTheGeek Nov 07 '08 at 08:46
  • 9
    One caveat with this that I've seen (in VS 2005 any way), it only searches through visible text. So if you have some collapsed in a region, for example, it won't search that. I don't know if this is a feature or a bug! – Adam Neal Jan 07 '09 at 21:00
  • 1
    Sounds like the emacs search feature. – dicroce Mar 10 '09 at 23:15
  • @Adam: In my experience, the fact that VS ignores hidden text (e.g. inside collapsed regions) makes this feature almost useless. Incremental search is an awesome feature, I just with they hadn't crippled it in VS. – Kevin Kibler Jan 22 '10 at 15:05
  • 2
    @CodeSavvyGeek: It's fixed in VS2010. – TheCloudlessSky Jun 28 '10 at 18:36
  • Hidden text not searcheable? This should be called excremental search, lol. VS2010 sp1 searches the hidden text too. – Valentin V Apr 22 '11 at 06:01
  • 1
    Actually, it is now in 2012 kind of merged with search(ctrl+f) into one feature – Marko Jul 13 '12 at 14:47
98

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

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

Ray
  • 45,695
  • 27
  • 126
  • 169
95

Ctrl+K, Ctrl+C Comment a block

Ctrl+K, Ctrl+U Uncomment the block

dance2die
  • 35,807
  • 39
  • 131
  • 194
  • Ctrl K, D formats the entire document (proper indents, ws cleaned up, etc.) in mine. ? – John Dunagan Oct 21 '08 at 20:40
  • I typically customize the mapping to be CTRL+/ (comment) and CTRL+SHIFT+/ (uncomment). I find that nice and intuitive. – el2iot2 Jan 25 '09 at 21:53
  • 8
    Ctrl-E, C and Ctrl-E, U also works. You dont have to release Ctrl after the first key either. – geofftnz Feb 09 '09 at 20:24
  • 2
    I use CTRL+/ withy Resharper.Resharper_LineComment which with one shortcut toggles line comments on and off. – Myster Sep 28 '09 at 22:47
  • I use this often so I like to customize this as well to something easy on the fingers: Alt-[ to uncomment, and Alt-] to comment. – Jared Thirsk Jan 04 '13 at 00:05
77

Stock Visual Studio? F12 - Edit.GoToDefinition.

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

Jasper
  • 2,166
  • 4
  • 30
  • 50
moobaa
  • 4,482
  • 1
  • 29
  • 31
71

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

MatthewT
  • 638
  • 6
  • 17
rbrayb
  • 46,440
  • 34
  • 114
  • 174
  • 2
    Fantastic - knew about snippets, but not that you could get to them so quickly! – xan Mar 25 '10 at 15:26
61

Ctrl+] for matching braces and parentheses.

Ctrl+Shift+] selects code between matching parentheses.

Barn Monkey
  • 245
  • 3
  • 11
Mark Cidade
  • 98,437
  • 31
  • 224
  • 236
  • 1
    Unfortunately, unlike most other keyboard shortcuts this one is language neutral. For example on a Danish keyboard it is CTRL+Å. For all the different ones see this StackOverflow question: http://stackoverflow.com/questions/1501921/go-to-matching-brace-in-visual-studio – Torben Junker Kjær Sep 09 '11 at 13:14
  • wow this one is great for looking through loooong lines of code someone else wrote – Jason Parker Jul 29 '13 at 15:27
60

Ctrl+Shift+F

Good old Find In Files.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Rob
  • 25,984
  • 32
  • 109
  • 155
51

Ctrl+Space, Visual Studio gives the possible completions.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Sirish
  • 9,183
  • 22
  • 72
  • 107
47

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

See Also: Answer

Community
  • 1
  • 1
Nescio
  • 27,645
  • 10
  • 53
  • 72
43

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.

Jasper
  • 2,166
  • 4
  • 30
  • 50
moltenform
  • 793
  • 7
  • 13
40

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

dance2die
  • 35,807
  • 39
  • 131
  • 194
Wedge
  • 19,513
  • 7
  • 48
  • 71
  • I've always found this feature too slow to be of any use. I wish they would improve its performance - sometimes its takes up to 20 seconds to load the items in the clipboard. – cbp Apr 06 '09 at 05:09
  • Use clipx if you want to do clipboard history. It spans all applications. http://www.bluemars.org/clipx/ – Tim Coker Jul 22 '10 at 16:44
  • in 2012 working great! than you :) – Marko Jul 13 '12 at 14:50
  • Wow this is awesome. This is a nice helper for all those times I thought I had "lost" my previous clipboard contents, it was still there the whole time. Thanks! – Jason Parker Dec 07 '12 at 15:36
34

Shift+ESC

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..

Jasper
  • 2,166
  • 4
  • 30
  • 50
Gordon Hartley
  • 489
  • 4
  • 10
  • This is awesome!!! (shift+esc) I always build, have the output window fly out and have the mouse cursor hovering, which prevents it from autohiding. This makes me move my hands off the keyboard, which I HATE. But thanks to this, you've solved my single biggest annoyance with visual studio. THANK YOU THANK YOU THANK YOU. – Tim Coker Jul 22 '10 at 16:46
  • 1
    "If you don't get rid of it, the only way to give it focus again is to use the same keyboard shortcut" - Alt+F6 cycles through open tool windows, faster to press than Ctrl-W-stuff – user472875 Dec 05 '11 at 05:58
  • On MSVC 6.0 (or something even older?) [ESC] did the hiding (actually toggling IIRC) the output window. I have looked a long time for a replacement to that one, thanks! – Valmond Apr 21 '12 at 17:43
  • VS 2012 use Ctrl+Shift+[ instead of Ctrl+Alt+L - which navigates to the current file instead of navigating to last selected file in Solution Explorer. – yzorg Jan 24 '13 at 15:58
34

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

dance2die
  • 35,807
  • 39
  • 131
  • 194
Adam Neal
  • 2,147
  • 7
  • 24
  • 39
  • 2
    Seems like ctrl + m + m works as well. So you don't have to release the ctrl button after the first m. – Jason Parker Dec 07 '12 at 15:38
  • Every one of shortcuts is editable and the default often is that there is version with ctrl two times or the firts time. – Preza8 Jul 30 '13 at 09:41
34

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 '>').

Update:

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

Ctrl + .

Much more comfortable than my original recommendation.

Community
  • 1
  • 1
Eric Schoonover
  • 47,184
  • 49
  • 157
  • 202
  • This is for View.SHowSmartTag so any smart tag that appears will have their menu openw ith this (e.g., implement interface). I change this mapping to Alt+Down arrow. – Mark Cidade Sep 19 '08 at 02:29
  • I tend to hit Windows button -> down -> right -> enter, which to me is faster than repositioning my hands in a weird way in order to press Shift+Alt+F10+Enter. – Rahul Sep 19 '08 at 08:14
  • 12
    You can do Ctrl + "." for the same purpose, and it's much, much more comfortable. – asterite Oct 27 '08 at 15:33
  • Yes, you can do Ctrl+".", but the original Shift + Alt + F10 will also work in other MS applications such as Outlook, PowerPoint, Excel and Word. – Dirk Vollmar Jan 21 '09 at 23:15
  • -1 as dup of one above (even if this was first, not surte if it was) – Ruben Bartelink Jun 26 '09 at 11:41
24

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:

http://www.codinghorror.com/blog/archives/000315.html

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Jeff Atwood
  • 63,320
  • 48
  • 150
  • 153
  • 2
    VS 2010: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=92ced922-d505-457a-8c9c-84036160639f – RandomEngy Nov 14 '10 at 02:48
24

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.

Justin R.
  • 23,435
  • 23
  • 108
  • 157
22

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;
dance2die
  • 35,807
  • 39
  • 131
  • 194
Keith Elder
  • 1,789
  • 1
  • 12
  • 13
19

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

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
SaaS Developer
  • 9,835
  • 7
  • 34
  • 45
19

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

Russell Myers
  • 2,009
  • 1
  • 15
  • 29
18

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)

dance2die
  • 35,807
  • 39
  • 131
  • 194
Jerph
  • 4,572
  • 3
  • 42
  • 41
17

CTRL+F5 (Start Without Debugging)

CTRL+SHIFT+B (Build Solution)

Beep beep
  • 18,873
  • 12
  • 63
  • 78
Giorgio Galante
  • 295
  • 2
  • 9
14

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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ashwin
  • 3,609
  • 2
  • 18
  • 11
13

Ctrl+F10

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

dance2die
  • 35,807
  • 39
  • 131
  • 194
Joel in Gö
  • 7,460
  • 9
  • 47
  • 77
12

By usage, the pair:

  • Ctrl+Enter: insert blank line above the current line.
  • Ctrl+Shift+Enter: insert blank line below the current line.
Sam Harwell
  • 97,721
  • 20
  • 209
  • 280
12

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

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Curtis
  • 101,612
  • 66
  • 270
  • 352
12

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

F10 : Debug.StepOver

:)

dance2die
  • 35,807
  • 39
  • 131
  • 194
Scott Ferguson
  • 7,690
  • 7
  • 41
  • 64
11

Ctrl+Alt+P -> Attach to process

dance2die
  • 35,807
  • 39
  • 131
  • 194
Chris Ballance
  • 33,810
  • 26
  • 104
  • 151
11

Haven't seen this one ...

Ctrl + Up

Ctrl + Down

Scrolls the window without moving the cursor.

Tim Coker
  • 6,484
  • 2
  • 31
  • 62
  • It depends. On Visual Basic 2005 Express Edition (is a version of Visual Studio 2005 - 8.0.50727.42 (RTM 050727-4200)), it instead jumps to the previous/next subroutine (*Sub* or *Function*). It is still useful, though. – Peter Mortensen Nov 27 '12 at 13:00
8

Select word: Ctrl+W

I can't live without that shortcut. Used over 100+ (or 200+) a day.

dance2die
  • 35,807
  • 39
  • 131
  • 194
8

Ctrl+Shift+S

Save all changed files. saved me quite a few times.

dance2die
  • 35,807
  • 39
  • 131
  • 194
shoosh
  • 76,898
  • 55
  • 205
  • 325
7

Ctrl+Shift+R Tools.RecordTemporaryMacro (again to stop recording)

Ctrl+Shift+P Tools.RunTemporaryMacro

Beats the heck out of trying to work out a regexp search and replace!

dance2die
  • 35,807
  • 39
  • 131
  • 194
J Francis
  • 1,358
  • 9
  • 15
  • I just disabled these. I hit record by mistake trying for show whitespace Ctrl+R, Ctrl+W. The macros bog everything down, and it takes me a while to figure out what's going wrong. – goodeye Mar 22 '12 at 00:29
7

Surround with: Ctrl + K , S.

It is great when you want to wrap some text in a tag.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
TheLukeMcCarthy
  • 2,253
  • 2
  • 25
  • 34
7

Good old Ctrl+Tab for flipping back and forth between open documents.

Visual Studio actually provides a very nice Ctrl+Tab implementation; I especially appreciate that the Ctrl+Tab document activation order is most-recently-used order, rather than simple "left-to-right" order, so that Ctrl+Tab (press once and release) can be used repeatedly to flip back and forth between the two most-recently-used documents, even when there are more than two documents open.

Jasper
  • 2,166
  • 4
  • 30
  • 50
Jon Schneider
  • 25,758
  • 23
  • 142
  • 170
7

Ctrl+R+T (Runs the current test)

Ctrl+R+A (Runs all tests in the project)

dance2die
  • 35,807
  • 39
  • 131
  • 194
Ian P
  • 12,840
  • 6
  • 48
  • 70
7

By far the most useful (after Ctrl+Shift+B) are:

  • Ctrl+K, C - to Comment out selection

  • Ctrl+k, U - to Uncomment a selection
dance2die
  • 35,807
  • 39
  • 131
  • 194
Don
  • 677
  • 5
  • 10
  • In VS 2008 selection is Ctrl+E C to comment and Ctrl+E U to uncomment. I like them along with Ctrl+E D to reformat. – si618 Jan 22 '09 at 00:12
  • Dup of http://stackoverflow.com/questions/98606/favorite-visual-studio-keyboard-shortcuts/99276#99276 – Ruben Bartelink Jun 26 '09 at 15:17
4

I like my code clean and arranged so my favorite keyboard shortcuts are the following:

Ctrl+K,D - Format document

Ctrl+K,F - Format selected code

Ctrl+E,S - Show white spaces

Ctrl+L - Cut line

Alt+Enter - Insert line below

Herb Caudill
  • 50,043
  • 39
  • 124
  • 173
Germstorm
  • 9,709
  • 14
  • 67
  • 83
4

Ctrl + I for incremental search.

Jasper
  • 2,166
  • 4
  • 30
  • 50
  • @FooBar : What does it mean? Incremental Search? – odiseh Feb 08 '10 at 10:13
  • @odiseh : Incremental search is where you start typing, and the selection keeps jumping to the first match of whatever you've typed so far. It usually saves you keystrokes, since you can just start typing until you've found what you're looking for. It also doesn't pop up a dialog. – Scott Smith Feb 28 '10 at 08:51
4

In debug mode, Alt * jumps to the current breakpoint, where execution is stopped.

Pierre
  • 4,114
  • 2
  • 34
  • 39
4

Ctrl+I for incremental search

dance2die
  • 35,807
  • 39
  • 131
  • 194
phloopy
  • 5,563
  • 4
  • 26
  • 37
3

The combination Ctrl+F3 and Ctrl+Shift+F3 for finding selected and previous selected item works very well for me.

dance2die
  • 35,807
  • 39
  • 131
  • 194
3

Ctrl+Shift+space shows the syntax/overloads for the current function you are typing parameters for.

Jainendra
  • 24,713
  • 30
  • 122
  • 169
Maslow
  • 18,464
  • 20
  • 106
  • 193
3

F9: toggle and un-toggle breakpoints!

dance2die
  • 35,807
  • 39
  • 131
  • 194
JohnIdol
  • 48,899
  • 61
  • 158
  • 242
3

Cutting and pasting lines

Everyone knows Ctrl + X and Ctrl + C for cutting/copying text; but did you know that in VS you don't have to select the text first if you want to cut or copy a single line? If nothing is selected, the whole line will be cut or copied.

Community
  • 1
  • 1
Herb Caudill
  • 50,043
  • 39
  • 124
  • 173
  • I'm floored by how many people don't know/use this. I'm also floored that the C# editor team still can't get the cursor placement correct. – Sam Harwell Sep 17 '09 at 20:42
  • Interesting, I actually didn't know that but always used the Shift+Del combination to do the same thing... which is prolly why I never noticed this way. – Brandon Moore Dec 10 '11 at 01:41
3

Showing hidden windows

  • ctrl+alt+L + Solution explorer

  • ctrl+alt+S + Server explorer

  • ctrl+alt+O + Output

  • ctrl+alt+X + Toolbox

  • ctrl+shift+W, 1 + Watch

  • ctrl+\, E + Error list

  • ctrl+shift+C + Class view

I like to use all my screen real estate for code and have everything else hidden away. These shortcuts keep these windows handy when I need them, so they can be out of the way the rest of the time.

dance2die
  • 35,807
  • 39
  • 131
  • 194
Herb Caudill
  • 50,043
  • 39
  • 124
  • 173
3

Open a newline above Ctrl + Enter

Open a newline below Ctrl + Shift + Enter

kev
  • 155,172
  • 47
  • 273
  • 272
3

Alt + B + U - Build the current project.

dance2die
  • 35,807
  • 39
  • 131
  • 194
etsuba
  • 151
  • 2
  • 10
3

Well, if you're really

always up for leaving my hands on the keyboard and away from the mouse!

Than you should go here

It's not really my favorite, it's just everything!

A shortcut a day will keep the mouse away.

Oren A
  • 5,870
  • 6
  • 43
  • 64
3

Ctrl + , for 'Navigate To' window (link)

hIpPy
  • 4,649
  • 6
  • 51
  • 65
3

CTRL + Alt +

This causes the list of open files to pop open in the upper right corner of the editor window. The cool thing is that it is searchable so you can leave go of the keys and start typing the file name to shift the focus to that file. Very handy when you have zillions of files open.

Peter Kelly
  • 14,253
  • 6
  • 54
  • 63
3

Ctrl + Alt + E = Exception/Catch Settings and code snippets

dance2die
  • 35,807
  • 39
  • 131
  • 194
RobS
  • 9,382
  • 3
  • 35
  • 63
3

I hate closing the extra tabs when I use "Start Debugging" on ASP.NET apps. Instead, I usually use "Start without Debugging" (Ctrl+F5).

If I end up needing to debug, I use Ctrl+Alt+P (Attach to Process)

and choose WebDev.WebServer.exe. Then I'm still on my previous page and I only have one tab open.

dance2die
  • 35,807
  • 39
  • 131
  • 194
Jerph
  • 4,572
  • 3
  • 42
  • 41
3

Ctrl+[ (Move to corresponding })

Ctrl+Shift+V (Cycle clipboard)

dance2die
  • 35,807
  • 39
  • 131
  • 194
2

Ctrl + W for selecting the current word

Jasper
  • 2,166
  • 4
  • 30
  • 50
2

Commenting

  • Ctrl+K, Ctrl+C - Comment current item

  • Ctrl+K, Ctrl+U - Uncomment current item

The great thing about this is that it applies to the element you're currently in - you don't have to select a whole line of VB code to comment it, for example, you just type Ctrl+K, Ctrl+C to comment the current line. On an aspx page, you can comment out a big chunk of code - for example an entire ListView - by just going to the first line and hitting Ctrl+K, Ctrl+C.

Community
  • 1
  • 1
Herb Caudill
  • 50,043
  • 39
  • 124
  • 173
2

The combination Ctrl+U and Ctrl+Shift+U for converting a block of characters to all upper/lower case.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Macke
  • 24,812
  • 7
  • 82
  • 118
2

Ctrl + K + C - set current selected code to be comments Ctrl + K + U - set current selected comments to be code

0x6C38
  • 6,796
  • 4
  • 35
  • 47
deype0
  • 1
  • 1
2

Some handy ones that I use often are:

Ctrl+J -> Forces Intellisence to pop up.

Ctrl+Alt+L -> Show the Solution Explorer.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Jeroen Landheer
  • 9,160
  • 2
  • 36
  • 43
2

Ctrl + BP (Previous bookmark), Ctrl + BN (Next bookmark)

0x6C38
  • 6,796
  • 4
  • 35
  • 47
Rashmi Pandit
  • 23,230
  • 17
  • 71
  • 111
2

Ctrl+Shift+B - Build

dance2die
  • 35,807
  • 39
  • 131
  • 194
ben
  • 3,126
  • 3
  • 37
  • 51
  • -1: Dup of http://stackoverflow.com/questions/98606/favorite-visual-studio-keyboard-shortcuts/99126#99126 (Even if it breaks the 'one' request) – Ruben Bartelink Jun 26 '09 at 15:22
2

There are some great tips and trips and shortcuts on Sara Ford's blog.

JasonS
  • 23,480
  • 9
  • 41
  • 46
2

F7 and Shift+F7 to switch between designer/code view

Ctrl+Break to stop a build.

Great for those "oh, I realized this won't compile and I don't want to waste my time" moments.

Alt+Enter opens the resharper smart tag

Bookmark ShortCuts

Ctrl+K Ctrl+K to place a bookmark

Ctrl+K Ctrl+N to go to next bookmark

Ctrl+K Ctrl+P to go to previous bookmark

The refactor shortcuts.

Each starts with Ctrl+R.

Follow it with Ctrl+R for rename. Ctrl+M for extract method. Ctrl+E for encapsulate field.

dance2die
  • 35,807
  • 39
  • 131
  • 194
2

If you have your keyboard settings set to the "Visual C# 2005" setting, the window switching and text editing chords are excellent. You hit the first combination of Ctrl + Key, then release and hit the next letter.

  • Ctrl+E, C: Comment Selected Text

  • Ctrl+E, U: Uncomment Selected Text

  • Ctrl+W, E: Show Error List

  • Ctrl+W, J: Show Object Browser

  • Ctrl+W, S: Show Solution Explorer

  • Ctrl+W, X: Show Toolbox

I still use F4 to show the properties pane so I don't know the chord for that one.

If you go to the Tools > Customise menu option and press the Keyboard button, it gives you a list of commands you can search to see if a shortcut is available, or you can select the "Press Shortcut Keys:" textbox and test shortcut keys you want to assign to see if they conflict.

Addendum: I just found another great one that I think I'll be using quite frequently: Ctrl+K, S

pops up an intellisense box asking you what you would like to surround the selected text with. It's exactly what I've needed all those times I've needed to wrap a block in a conditional or a try/catch.

dance2die
  • 35,807
  • 39
  • 131
  • 194
Shabbyrobe
  • 12,298
  • 15
  • 60
  • 87
  • That Ctrl+K, S is awesome!!!. Coupled with successive Ctrl+W and you have a winner for fast coding. – Alex. S. Oct 14 '10 at 16:19
1

Ctrl+M, Ctrl+O : collapse to definitions. I use it all the time together with #regions

(despite what Jeff says) to get an overview of the code on my screen.

dance2die
  • 35,807
  • 39
  • 131
  • 194
Joel in Gö
  • 7,460
  • 9
  • 47
  • 77
1

Ctrl + K, D to auto format code.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Amal Dev
  • 1,938
  • 1
  • 14
  • 26
1

I'm a big fan of Ctrl + D + Q to open quickwatch while debugging.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ehz
  • 2,027
  • 1
  • 12
  • 11
1

I just found out that Shift+F11 steps out of the current function.

This is very useful when you want to debug function foo in foo(bar(baz()). Use F11, Shift+F11 to jump in and out of bar and baz.

dance2die
  • 35,807
  • 39
  • 131
  • 194
1

Alt+Shift+ Arrow keys() or mouse moving = Block/Column selection

comes really handy

dance2die
  • 35,807
  • 39
  • 131
  • 194
Mladen
  • 1,710
  • 12
  • 4
1

Ctrl+Shift+V multiple times cycles through the clipboard ring.

Sam Harwell
  • 97,721
  • 20
  • 209
  • 280
1

Control+Apostrophe.

Oh wait, that was after I remapped it away from that god-awkward Alt+Shift+F10 or whatever it was.

When you remap options to help bind this away from it's original hard to hit shortcut, it becomes a lot lot more useful.

MiffTheFox
  • 21,302
  • 14
  • 69
  • 94
  • Really? i *love* Alt-Shift-F10! – RCIX Oct 28 '09 at 09:03
  • @RCIX - To clarify, I love what Alt+Shift+F10 does, but I don't love how hard it is to hit compared to Ctrl+Apostrophe. – MiffTheFox Oct 28 '09 at 15:21
  • 1
    Posting just the keys themselves is pointless. Most (sensible) people don't know what Alt+Shift+F10 because they've always used Ctrl + . – Ash Jan 29 '10 at 04:20
1

Find and replace

  • Ctrl+F and Ctrl+H - Find, Find & replace, respectively

  • Ctrl+shift+F and Ctrl+shift+H - Find in files, Find & replace in files, respectively

"Find in files" has been an enormous productivity booster for me. Rather than jump to each result one by one, it just shows you a list of results in your entire project or solution. It makes it very simple to find sample code, or see if a function is used anywhere.

Community
  • 1
  • 1
Herb Caudill
  • 50,043
  • 39
  • 124
  • 173
1

It's simple, but

Ctrl + L

deletes the entire line. Great for fast code editing.

Adam Neal
  • 2,147
  • 7
  • 24
  • 39
Paul
  • 5,376
  • 1
  • 20
  • 19
1

F7 toggles from design view to code view.

dance2die
  • 35,807
  • 39
  • 131
  • 194
wusher
  • 12,291
  • 22
  • 72
  • 95
1

Not a keyboard shortcut, but with your mouse, you can use forward and backwards buttons on your mouse to go to previous locations in your code and return to your current location.

1

If you install Visual Assist X, which I highly recommend you do, these are useful:

  • Alt+O: Toggle current document between header/implementation (.h/.cpp)

  • Alt+G: Go to definition/declaration

dance2die
  • 35,807
  • 39
  • 131
  • 194
korona
  • 2,308
  • 1
  • 22
  • 37
1

F7 to build and then F8 to go to the errors and warnings one by one.

dance2die
  • 35,807
  • 39
  • 131
  • 194
Atempcode
  • 397
  • 1
  • 4
1

I mapped all of the expand/collapse commands so that they can be used with the left and only so my right hand stays on my mouse.
Ctrl + E, Ctrl + E toggles expansion,Ctrl + E, Ctrl + D collapses all to definitions, Ctrl + E, Ctrl + A toggles all outlining.

Jasper
  • 2,166
  • 4
  • 30
  • 50
Tim Coker
  • 6,484
  • 2
  • 31
  • 62
  • Funny, I always prefer my hands to stay on the keyboard and try not to use the mouse. (The down-vote isn't mine, though.) – sbi Jul 22 '10 at 18:58
  • 99% of the time i keep my hands on the keyboard, too. But there are times when I'm studying code that its convenient to have a hand on the mouse and being able to expand/collapse with just my left hand is very useful. – Tim Coker Jul 22 '10 at 19:45
1

Ctrl + R + W to display whitespace (great for tab or space enforcement).

Also, holding down Alt while selecting with the mouse will create a rectangular region.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Pierre
  • 4,114
  • 2
  • 34
  • 39
1

Alt+F4 ;)

But on a more serious note, Ctrl+Space is probably hit a lot from me, in my limited usage of VS.

ocharles
  • 6,172
  • 2
  • 35
  • 46
1

Ctrl+Shift+R -> Refactor with Resharper

dance2die
  • 35,807
  • 39
  • 131
  • 194
Chris
  • 6,702
  • 8
  • 44
  • 60
1

Ctrl+ E + D : Format Document

Tip for teams: Set up agreed-on formatting options in Visual Studio (they are very flexible), then export the settings to a .settings file for each developer to import.

Now if all developers learn to autoformat everything, it will not only produce perfect formatting consistency throughout the project with no effort at all, but also greatly reduce annoying false differences in the diff tool when merging multiple check-ins to Source Control.

Oh, I enjoy good tools!

Tor Haugen
  • 19,509
  • 9
  • 45
  • 63
  • I see Sung Meister lists the same command, but with a different key combination. Myself, I use the Visual C# environment settings, I guess he doesn't. – Tor Haugen Mar 11 '09 at 02:42
1

Insert snippet:

Ctrl+K, Ctrl+S

I use if often for try..catch and #region

Jasper
  • 2,166
  • 4
  • 30
  • 50
callisto
  • 4,921
  • 11
  • 51
  • 92
  • I instead just type `try` or `#region` and then hit TAB, TAB. (But that might be helpful if you forget which snippets, such as for Dr. WPF's big list of property snippets for WPF: [link](http://drwpf.com/blog/2007/11/17/my-wpf-code-snippets/)) – Jared Thirsk Jan 06 '13 at 11:36
1

Ctrl+Shift+8 - Backtracks go to previous "F12/ Go to definition"

dance2die
  • 35,807
  • 39
  • 131
  • 194
vzczc
  • 9,270
  • 5
  • 52
  • 61
  • Ctrl + Shift + 7 is the complementary shortcut to do that - go fwd to next Go To Def invoked in the chain. – Gishu Nov 07 '08 at 08:29
0

Ctrl+X

This cuts (to clipboard) the current line of code.

Greg
  • 23,155
  • 11
  • 57
  • 79
Morten Christiansen
  • 19,002
  • 22
  • 69
  • 94
0

Nothing beats Ctrl+Shift+B - Building the solution!!

As far as navigation control, Ctrl+- and Ctrl++ is nice...

But I prefer Ctrl+K+K ---> creates bookmark...

and Ctrl+K+N ---> to navigate to the next bookmark... awesome stuff...

dance2die
  • 35,807
  • 39
  • 131
  • 194
RWendi
  • 1,446
  • 5
  • 20
  • 38
0

Another useful Find short key sequence is Ctrl (+ Shift) F --> ALT C --> ALT W for switching between exact and fuzzy searches.

0

I'm addicted to some very subtle stuff in http://blog.jpboodhoo.com/UsefulVSKeySequencesShortcuts.aspx

e.g. Alt-W U to auto collapse everything when in Full screen mode when it all gets too much

0x6C38
  • 6,796
  • 4
  • 35
  • 47
Ruben Bartelink
  • 59,778
  • 26
  • 187
  • 249
0

Ctrl + .

To include a missing library.

PriestVallon
  • 1,519
  • 1
  • 22
  • 44
0

Save LOTS of time copy and cutting:

  • Ctrl+C with no selection in the line: copies the whole line

  • Ctrl+X with no selection - cuts the whole line
dance2die
  • 35,807
  • 39
  • 131
  • 194
RoyOsherove
  • 3,269
  • 2
  • 29
  • 26
0

Ctrl+K, Ctrl+D - Format the current document.

Helped me fix indentation and remove unneeded spaces quickly

dance2die
  • 35,807
  • 39
  • 131
  • 194
Dror Helper
  • 30,292
  • 15
  • 80
  • 129
0

"prop" and hit tab.. stubs out property for you...

CSharpAtl
  • 7,374
  • 8
  • 39
  • 53
0

Paste in loop Ctrl + Shift + V

Expand Collapse current block - Ctrl + M + M

Code Snippet - for creating property type prop and press tab.

0x6C38
  • 6,796
  • 4
  • 35
  • 47
MRG
  • 3,219
  • 1
  • 26
  • 35
0

Ctrl+M, Ctrl+L will expand every collapsed bit of code. It is the opposite of Ctrl+M, Ctrl+O

dance2die
  • 35,807
  • 39
  • 131
  • 194
Franck Mesirard
  • 3,169
  • 3
  • 20
  • 17
0

Turn line wrapping on and off

Ctrl+E, Ctrl+W

Sometimes you want to see the flow of the code with all of your indents in place; sometimes you need to see all 50 attributes in a GridView declaration. This lets you easily switch back and forth.

Community
  • 1
  • 1
Herb Caudill
  • 50,043
  • 39
  • 124
  • 173
0

Format document

   Ctrl+K, Ctrl+D
  1. On an aspx page, this takes care of properly indenting all of your markup and ensures that everything is XHTML compliant (adds quotes to attributes, corrects capitalization, closes self-closing tags). I find that this makes it much easier to find mismatched tags and to make sure that my markup makes sense. If you don't like how it's indenting, you can control which tags go on their own line and how much space they get around them under Tools/Options/Text Editor/HTML/Format/Tag Specific Options.

  2. In your C# or VB code, this will correct any capitalization or formatting issues that didn't get caught automatically.

  3. For CSS files, you can choose compact (one definition per line), semi-expanded, or expanded (each rule on its own line); and you can choose how it handles capitalization.

Community
  • 1
  • 1
Herb Caudill
  • 50,043
  • 39
  • 124
  • 173
0

Refresh javascript intellisense and code coloring.


ctrl+shift+J

I've found intellisense for Javascript to be flaky - this usually straightens it out.

dance2die
  • 35,807
  • 39
  • 131
  • 194
Herb Caudill
  • 50,043
  • 39
  • 124
  • 173
0

Outlining

  • ctrl+M, ctrl+M - Collapse/expand current element

  • ctrl+M, ctrl+O - Collapse all (gives you a nice overview of a complex class, for example)

  • ctrl+M, ctrl+O - Toggle all

This works both in VB/C# code (e.g. collapse/expand a function) and in an aspx page (e.g. collapse/expand a GridView definition).

One very nice use of this is to cut or copy a big chunk of markup or code: For example, to move a big, sprawling <table> or <asp:gridview> definition:

  1. Go to the first line

  2. ctrl+M, ctrl+M to collapse it

  3. ctrl+X to cut it (you don't have to select it, as long as your insertion point is still in that line)

  4. Move to where you want it and ctrl+V to paste.
Community
  • 1
  • 1
Herb Caudill
  • 50,043
  • 39
  • 124
  • 173
0

Snippets

Each snippet has a shortcut that you can access by typing a word then tab. The one I use the most is for a standard property definition; just type property then tab.

Community
  • 1
  • 1
Herb Caudill
  • 50,043
  • 39
  • 124
  • 173
0

Ctrl + M, L - Expands all regions

Evan
  • 6,151
  • 1
  • 26
  • 43
0

I don't think that any shortcut is remaining for me to mention so let me mention a shortcut that I would love Visual Studio to have :-) One shortcut that I really miss and that is present in Eclipse is "Open Resource" (Ctrl + Shift + S) which allows you to type in a file name and the IDE displays the files matching it. Really useful when you are working with bid code bases!

0x6C38
  • 6,796
  • 4
  • 35
  • 47
Aayush Puri
  • 1,789
  • 3
  • 15
  • 19
  • See [Ctrl+/](http://stackoverflow.com/questions/98606/favorite-visual-studio-keyboard-shortcuts/1441130#1441130). – sbi Jun 02 '10 at 10:42
0

Open a file without using the mouse:

CTRL + ALT + A (opens command window) Followed by >open somedoc

I didn't see this one yet. Can't believe how many cool shortcuts have been posted here!

dance2die
  • 35,807
  • 39
  • 131
  • 194
0

Ctrl+A, K, F

Select all, prettyprint.

James Jones
  • 8,653
  • 6
  • 34
  • 46
0

Here's a link to a list of Shortcuts I find usefull (VS2003) but some still apply,

My favorite being F12 and Ctrl+- to navigate to the declaration and back

dance2die
  • 35,807
  • 39
  • 131
  • 194
CheGueVerra
  • 7,849
  • 4
  • 37
  • 49
0

Ctrl+- and Ctrl+Shift+-

Alt+D, P Attach the debugger to the application.

(first letter of any application you want to debug, works most of the time)

Ctrl+Shift+F

Ctrl+I (incremental seach)

dance2die
  • 35,807
  • 39
  • 131
  • 194
0

Simple one. F8 : Go to next build error.

Found that now it will work in any sort of list window (the ones that cluster together at the bottom usually.

dance2die
  • 35,807
  • 39
  • 131
  • 194
Gishu
  • 134,492
  • 47
  • 225
  • 308
0

People have mentioned Ctrl+C and Ctrl+V to paste a line when nothing is selected but I use Ctrl+X to move lines of code regularly.

Andrew Boes
  • 2,013
  • 4
  • 22
  • 29
0

Hmmm, nobody said F1 for help.

Could it be that Google is faster and better for getting at the information that you need.

dance2die
  • 35,807
  • 39
  • 131
  • 194
Ron Todosichuk
  • 274
  • 1
  • 5
  • Hit F1, make a coffee, go to google, type in your query (one finger typing), fully read each search return on the first 3 1/2 pages, find your answer and fix the code, catch a train home, do the cryptic crossword, have a beer, sleep in, go to work and have a coffee, check your pc, and wait ... – johnc Mar 05 '09 at 06:48
  • There's nothing more frustrating than accidentally hitting F1 – hacker Mar 11 '09 at 17:24
  • Perhaps F1 should just open a browser pointed at Google in a Visual Studio tab. I love how Google is better at finding reference materials than most web site's own searches (and most application's built-in references in this case). – Triynko Oct 28 '09 at 05:44
0

VS 2008

  1. Ctrl+E,D : Format Code

  2. Ctrl+M,O : Collapse To Definitions

  3. Ctrl+Z : Undo :)

  4. F9: Breakpoint

  5. Ctrl+Shift+F9 : Delete All Breakpoints

dance2die
  • 35,807
  • 39
  • 131
  • 194
0

Hopefully this hasn't already been posted, apologies if so. I've just come across a useful keyboard shortcut in Visual Studio 2008. With the QuickWatch window open, highlight a row with a string value in it and hit Space Bar. The text visualiser window will appear with the value in it.

I have found it quite useful for checking jQuery innerText values as the QuickWatch window by default is too small to show longer strings fully.

Malice
  • 3,927
  • 1
  • 36
  • 52
0

Visual Studio 2010 Keybinding Posters

TheLukeMcCarthy
  • 2,253
  • 2
  • 25
  • 34
0

Ctrl+Shift+Alt+B Rebuild Solution.

Ctrl+R, Ctrl+T Debug Tests in Current Context

Jakub Linhart
  • 4,062
  • 1
  • 26
  • 42
0

The ones I use all the time:

  • ctrl+] Matching Brace

  • ctrl+shift+] Select to the end of brace

  • ctrl+shift+q Untabify

  • ctrl+k,ctrl+c comment out the currently selected block

  • ctrl+k,ctrl+u uncomment out the currently selected block

  • alt+mouse move vertical selection

  • ctrl+alt+x toolbox

  • ctrl+shift+b build

sbi
  • 219,715
  • 46
  • 258
  • 445
Aaron Saarela
  • 3,956
  • 1
  • 19
  • 17
0

Ctrl+Shift+F4 to close all windows. You have to map it yourself:

Instructions:

  • In Visual Studio, go to Tool | Options
  • Under Environment select Keyboard
  • In Show commands containing, enter Window.CloseAllDocuments. You should get a single entry in the listbox below it
  • Put the cursor in Press shortcut keys and press Ctrl+Shift+F4.
  • Click OK

Credit to Kyle Baley at codebetter.com. I modified his example to use shift instead of alt because it was easier on my hands.

dance2die
  • 35,807
  • 39
  • 131
  • 194
Eric Bock
  • 1,732
  • 1
  • 18
  • 22
0

I've mapped File.Close to CTRL+SHIFT+W. That and CTRL+TAB mean you can close exactly whichever files you want.

Jonathan Parker
  • 6,705
  • 3
  • 43
  • 54
0

I am surprised not to find this one on the list as I use it all the time:

Ctrl + K, Ctrl + M - Implement method stub.

Write a call to a non-existent method, and then use that shortcut to create the method in the right place, with the right parameters and return value, but with a method body that just throws a NotImplementedException.

Great for top-down coding.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Jackson Pope
  • 14,520
  • 6
  • 56
  • 80
0

I think Ctrl + K + D is definitely my favourite. I use it more than any other shortcuts. It helps to format the document according to the indentation and code formatting settings specified by us.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Joyce
  • 437
  • 1
  • 8
  • 20
0

Here are my favourite debugging keyboard shortcuts:

  • F5 : start debugger / run to next breakpoint
  • Shift+F5 : stop debugging
  • F10 : step over next statement
  • F11 : step into next statement
  • Ctrl+F10: run to the cursor location
  • F9 : add or remove breakpoint
0x6C38
  • 6,796
  • 4
  • 35
  • 47
Phillip Ngan
  • 15,482
  • 8
  • 63
  • 79
0

Use Emacs-like keybinding, it's TAB :P

0x6C38
  • 6,796
  • 4
  • 35
  • 47
0

What Ray said. Ctrl + ..

I really didn't like the smart tags (those little blue and red underscores that appear wanting to help you) until I found out that you don't need to waste time trying to hover the mouse over the exact pixel that gets the menu to show.

I think Ctrl + . to open the smart tag menu saves me about five minutes every day and reduces my blood pressure considerably.

Community
  • 1
  • 1
Hamish Smith
  • 8,153
  • 1
  • 34
  • 48
0

Ctrl+Shift+S // Save

Ctrl+Shift+B // Build

dance2die
  • 35,807
  • 39
  • 131
  • 194
Dan Coates
  • 2,002
  • 3
  • 17
  • 21
0

I have two that I use a lot, the first is standard, the second you have to map:

Ctrl+A, Ctrl+E, F (Select All, Format Selection)

Ctrl+E, R (Remove Unused Usings and Sort)

Both help pay down the "cruft debt" early and often

dance2die
  • 35,807
  • 39
  • 131
  • 194
lesscode
  • 6,221
  • 30
  • 58
0

Ctrl+K then Ctrl+H to add a line of code to the built in task/todo list

(Ctrl+Alt+K). Very handy!

dance2die
  • 35,807
  • 39
  • 131
  • 194
ine
  • 14,014
  • 8
  • 55
  • 80
-1

Ctrl+- and Ctrl+Shift+-. But if you are a keyboard lover then go for Resharper

dance2die
  • 35,807
  • 39
  • 131
  • 194