
Hi, habrorazrabchchik!
No, this is not another contest. The keyboard A slept and get the keyboard G. Today we will talk about hot keys in Visual Studio 2008.
Many of us use all sorts of plugins, extensions for Visual Studio. It is worth noting that many of them are quite comfortable. And along with code snippets significantly speed up the work. You can read about plugins
here and
here , about code snippets
here . Those who are not familiar with such “buns” are strongly recommended to try and use.
')
As for me, I used Visual Assist, later tried using R #. But if I refused the first one when I stopped programming in C ++, the second one “killed” completely my computer if I tried to open more than 2 studios. Despite the fact that now both the computer is more powerful and R # has certainly improved, I do not use it. This is due to the fact that I found then the opportunity to "breathe" more freely, using the "hot keys".
Here I will describe those hotkeys that I use and consider as convenient and necessary for memorization.
Development schemes
First of all, I want to draw your attention to the fact that in Visual Studio there are several schemes for developers, which you can switch through the menu, as shown below:

Also in this menu, you can add or remove hotkeys by “sharpening” even more for yourself. The setup is pretty simple.
I will consider the described examples for the Visual C # 2005 schema.
Commenting.
There are several shortcut keys for creating comments:
Ctrl + E, C - comment out selected lines in code.
Ctrl + E, U - uncomment selected lines in code.
If before the method name you type
/// - XML ​​comments will be automatically added, which can then be used to create documentation.
Search
Someone uses the search to refactor, someone to get acquainted with his own code, life can be improved quite easily:
Ctrl + F - a standard search window opens, if text has been recently copied to the buffer, it will automatically be substituted.
Ctrl + F3 - search for “active” text down (which is highlighted or the word on which the cursor stands), without copying to the clipboard.
Ctrl + Shift + F3 - search for "active" text up.
Ctrl + I - and start typing text, a sort of runtime search.
Summon Base Genie
Are you too lazy to write the text completely? Speed ​​of falling out Intellisence does not suit your thought rushing ahead of you ?!
Then it's time to apply the following combinations:
Ctrl + Space - call Intellisence with the display of "words"
Ctrl + J - if you forget the name of the class method or its property, this combination will help you. You can apply the previous one, but this one is more “smart”.
Ctrl + K, X - showing all snippets that you have, in the form of a drop-down list, the use is intuitive :)
short_snypet_name + Tab - use a snippet in code. A list of basic snippets can be found
here . I myself made a slightly trimmed version and hung it next to the monitor.
Code Navigation
It’s worth to say separately and quite a lot, the navigation is very convenient, especially when you get used to it :)
F12 - go to the definition / declaration of the class / method / property. It is very applicable if you suddenly wondered if this variable is implemented, this class is IDisposable interface type; or you are looking for in the code “where is the variable declared.”
Ctrl + G - go to a specific line number in the code. (Displaying line numbers can be enabled: Text Editor -> Language of interest to you -> Display -> Line numbers - set the checkbox). Sometimes it’s quite convenient, especially if you get a description of an unhandled exception, and there is usually a line number.
Ctrl +] - when the cursor is positioned on the bracket, multi-line comment (/ * * /), region (#region), a line framed with quotes, this combination will allow you to see the beginning and end of these “blocks” by moving the cursor between them.
Ctrl + M, M - I’m a rather lazy person and it’s hard for me to get a long time to poke the mouse over ±, turn off the “blocks”, so I recommend this combination
Ctr + M, O - a combination similar to the previous one, only collapses
all blocks
Ctrl + - - go to the previous active text (the one you edited)
Ctrl + Shift + - - go to the next active text, if it is of course;)
If you pay attention to the studio, by its nature MDI, it means that it should be possible to move between windows:
Ctrl + Tab is an analogue of Alt + Tab in Windows, only applicable to the studio.
A very convenient tool in the studio are bookmarks, yes, yes, by analogy with the book. You can mark the code to go to it later:
Ctrl + B, T - put / remove bookmark.
Ctrl + B, Ctrl + C - delete all bookmarks.
Ctrl + B, N - go to the next tab.
Ctrl + B, P - go to the previous tab.
Formatting and editing
Many people know and use
Ctrl + C and
Ctrl + V , but the studio has some more convenient combinations:
Ctrl + Shift + V - without releasing Ctrl + Shift and pressing V, you can paste one of the last 10 pieces of text copied to the clipboard.
Tab - increase indent.
Shift + Tab - reduce indent.
I sometimes lacked vertical selection of the text, it is useful. It turns out that there is such an opportunity! It is necessary to press
Alt , and without releasing,
select the text with the
mouse . But there is a minus - the menu and keyboard arrows :). This can be solved, press
Shift + Al t and use the
Left or
Right arrows
If the code you got is “dirty”, not only in structure but also in appearance, use:
Ctrl + E + D - formatting the entire document allows you to bring the document into a more digestible form.
Ctrl + E + F - format the selected part of the text
Sometimes in order to refactor or even some good undertakings, it makes sense to translate all the letters in upper or lower case:
Ctrl + Shift + U - convert the selected block to upper case
Ctrl + U - convert the selected block to lowercase
A small excursion into the assembly and debugging
Of course, from the hotkeys :)
Let's start with the "assembly":
Ctrl + Shift + B or
F6 - build a solution.
Shift + F6 - to collect the active project.
To be honest, here I was a little messy, imprisoned for myself, sometimes it is convenient to rebuild the RebuildSolution project, but for some reason the hotkey is not provided for this, I did the following:
F6 - build a solution
Ctrl + Shift + B - rebuild solution
I did this because of the consideration that sometimes the studio does not reassemble the project, but writes “up-to-date”, and I need to rebuild it.
If there are errors, this is bad, but no one is immune from them:
F5 - run the program, with the possibility of debugging. Or continue with the program after the breakpoint.
Ctrl + F5 - run the program without debugging
F9 - set / remove breakpoint - breakpoint
Ctrl + Shift + F9 - remove all breakpoints.
F10 - execute the code, without going inside
F11 - execute code, go inside
In debug mode, there are two types of viewing - Watch and QuickWatch. The difference between them is beyond the scope of this topic :).
However, you can call QuickWatch by pressing
Ctrl + D, Q. Just Watch -
Ctrl + D, W.PS: if someone turned out to be “not enough”, then you can get information
on the Sarah Ford blog , those who are not very friendly with English, have the opportunity to
read translations that appear very regularly.