Visual studio hotkeys

    image
    Hi, habro-developer!
    No, this is not another contest slept keyboard A and get keyboard G. Today we’ll talk about the hot keys in Visual Studio 2008.



    Many of us use all kinds of plug-ins, extensions for Visual Studio. It is worth noting that many of them are quite convenient. And coupled with code snippets significantly speed up the work. You can read about plugins here and here , about code snippets here . For those who are not familiar with such “goodies”, I strongly recommend trying and using.

    As for me, I used Visual Assist, later tried to use R #. But if I refused the first one when I stopped programming in C ++, then the second “killed” my computer completely, if I tried to open more than 2 studios. Despite the fact that now the computer is more powerful and R # has undoubtedly improved, I do not use it. This is due to the fact that I then found the opportunity to "breathe" more freely using the "hot keys".

    Here I will describe those hotkeys that I use and consider convenient and necessary for remembering.

    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:
    image

    Also in this menu, you can add or remove hotkeys by “sharpening” even more for you. The setup is pretty straightforward.

    I will consider the described examples for the Visual C # 2005 scheme.

    Commenting out.


    There are several key combinations for creating comments:
    Ctrl + E, C - comment out the selected lines in the code.
    Ctrl + E, U - uncomment selected lines in the code.

    If you type /// before the method name , XML comments will be automatically added, which you can then use to create documentation.

    Search


    Someone uses the search for refactoring, someone to familiarize themselves with their own code, life can be improved quite easily:
    Ctrl + F - a standard search window opens, if the text was recently copied to the buffer, it will automatically substitute.
    Ctrl + F3 - search for “active” text down (which is highlighted or the word the cursor is on), without copying to the clipboard.
    Ctrl + Shift + F3 - search for “active” text up.
    Ctrl + I - and you start typing text, a sort of runtime search.

    Calling a Genie


    Are you too lazy to write the text completely ?! The speed of the falling 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 have forgotten the name of a class method or its property, then this combination will help you. You can apply the previous one, but this one is more “smart”.
    Ctrl + K, X - show all the snippets that you have in the form of a drop-down list, the use is intuitive :)
    short snippet_name + Tab - use the snippet in the code. A list of basic snippets can be found here . Myself, I made a slightly stripped-down version and hung next to the monitor.

    Code Navigation


    It is worth saying separately and quite a lot, the navigation is very convenient, especially when you get used to it :)
    F12 - go to the definition / declaration of a class / method / property. It is very applicable if it suddenly became of interest to you whether the variable IDisposable is implemented by this class of this class; or you look in the code, "and where is this variable declared."
    Ctrl + G - go to a specific line number in the code. (The display of line numbers can be turned on: Text Editor -> Language of interest to you -> Display -> Line numbers - check the box). Sometimes it’s quite convenient, especially if you get a description of the unhandled exception, and it usually indicates the line number there.
    Ctrl +]- when the cursor is placed on the bracket, multi-line comment (/ * * /), region (#region), a line surrounded by quotation marks, 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 pretty lazy person and it’s hard for me to make ± poke my mouse for a long time, I collapse and expand the “blocks”, so I recommend this combination
    Ctr + M, O - a combination similar to the previous one, only collapses all the blocks
    Ctrl + - - go to 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 fact that the studio, by its nature MDI, means there should be the ability to move between windows:
    Ctrl + Tab - an analog of Alt + Tab in Windows, only applicable to the studio.

    Bookmarks are a very convenient tool in the studio, yes, by analogy with book ones. You can mark the code to go to it later:
    Ctrl + B, T - put / uncheck the bookmark.
    Ctrl + B, Ctrl + C - delete all bookmarks.
    Ctrl + B, N - go to the next bookmark.
    Ctrl + B, P - go to the previous bookmark.

    Formatting and Editing


    Many people know and use Ctrl + C and Ctrl + V , but the studio has a number of 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 the indent.
    Shift + Tab - reduce the indent.

    Sometimes I missed the vertical selection of the text, it is useful. It turns out that there is such an opportunity! It is worth pressing Alt , and without releasing, select the text with the mouse . But there is a minus - the menu and keyboard arrows :). This is 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 in a more digestible form.
    Ctrl + E + F - formatting the selected part of the text

    Sometimes, for refactoring or some other good undertakings, it makes sense to translate all letters to upper or lower case:
    Ctrl + Shift + U - translate the selected block to upper case
    Ctrl + U - translate highlighted block in lower case

    A small digression into assembly and debugging



    Of course, from the side of hotkeys :)
    Let's start with the “assembly”:
    Ctrl + Shift + B or F6 - assemble the solution.
    Shift + F6 - assemble an active project.
    To be honest, here I mocked a little, imprisoning for myself, sometimes it’s convenient to rebuild the RebuildSolution project, but for some reason there is no hotkey for this, I did the following:
    F6 - assemble the solution
    Ctrl + Shift + B - rebuild the solution
    I did this from -for reasons that sometimes the studio does not rebuild the project, but writes “up-to-date”, and I need to rebuild it.

    If errors appear, this is bad, but no one is safe from them:
    F5- run the program, with the ability to debug. Or continue the program after the breakpoint.
    Ctrl + F5 - run the program without debugging
    F9 - set / remove a breakpoint - breakpoint
    Ctrl + Shift + F9 - delete all breakpoints.
    F10 - execute code, without going inside
    F11 - execute code, with going 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 pressing the Ctrl + D, the Q . Just Watch - Ctrl + D, W .

    PS: if someone turned out to be "small", then you can get information on the blog of Sarah FordThose who are not very friendly with English have the opportunity to read translations that appear very regularly.

    Also popular now: