- Common shortcut keys
- Automatically generate header annotations
- Code Snippets
- NuGet
- Team Foundation
Common vs Shortcut keys
- View and set shortcut keys
Usually in the menu we can see some of the functions of the shortcut keys. Alternatively, you can view and set the shortcut keys for the corresponding function through the menu bar-tools-options-environment-keyboard
- Recommend a few of my more commonly used shortcut keys
I'm using the VS2015 Community Edition, so there might be some shortcuts and other versions
Ctrl + K,ctrl + U |
Uncomment the selected row or row of the cursor |
Ctrl + K,ctrl + D |
Align all the code correctly |
Ctrl + R,ctrl +r |
Renaming |
Ctrl + K,ctrl +s |
Inserting the outer code |
Ctrl +. |
Fast operation or refactoring (Universal key!!!) ) |
Ctrl + Delete |
Delete all words to the right of the cursor |
Ctrl + X |
Cut or delete the selected code or cursor in the row |
Ctrl + L |
Cut or delete the selected code or cursor in the row |
Ctrl + G |
Jump to line number or line |
Ctrl + Enter |
Inserts a blank line in the current row |
Ctrl + Shift + Enter |
Insert a blank line below the current line |
Ctrl + Shift + SPACEBAR |
Code hints (see what the function parameters are most useful for) |
Alt + arrow (↑,↓) |
Move up or down the line of the cursor or the selected code |
Shift + F12 |
Find All references |
F12 |
Jump to Definition |
F9 |
Set or remove breakpoints |
Automatically generate header annotations
More common there are two ways, one is to modify the template file, the other is to edit the macro, the way through the macro every time you want to use the shortcut key, so we recommend that you use the way to modify the template, as long as the next time you add program files automatically generated.
First find the installation directory of VS, find Common7\ide\itemtemplatescache in turn, note that itemtemplatescache instead of itemtemplates, Although both directories are available, files under the ItemTemplates directory cannot be restored once they are modified.
If you're using C # then you can open the file from the Itemtemplatescache folder, and then edit the template file
using System; using system.collections.generic;$ if 3.5) using System.Linq; $endif $ using system.text;$ if 4.5) using System.Threading.Tasks; $endif $ namespace $rootnamespace ${ class $safeitemrootname $ { }}
Template file after adding a comment
// =============================================================================== //Author:helloc//Email: [Email protected]//Create Time: $time $//Update Time: $time $// =============================================================================== //CLR Version: $clrversion $//Class version:v1.0.0.0//Class Description:// ===============================================================================//COPYRIGHT©YJP $year $. All rights reserved.// ===============================================================================usingSystem;usingsystem.collections.generic;$if$ ($targetframeworkversion $ >=3.5)usingSystem.Linq; $endif $usingsystem.text;$if$ ($targetframeworkversion $ >=4.5)usingSystem.Threading.Tasks; $endif $namespace$rootnamespace ${class$safeitemrootname $ {}}
After the configuration is complete we can add a class file to see the effect, yo West!
Here are the more commonly used template configuration variables
$time $ |
Time |
$year $ |
Year |
$userdomain $ |
The current user domain |
$username $ |
The current user name |
$clrversion $ |
CLR version |
$machinename $ |
Computer name |
$safeitemname $ |
Filename |
$rootnamespace $ |
Name space |
Code Snippets
What is a code snippet? When you're writing a For loop, is it just a matter of knocking down for these letters and pressing the TAB key, VS gives you the auto-generated code for the For loop, and if you want to hit a few letters and press the TAB key to generate a piece of code, you need to use the VS Snippet feature
First, you can find the "Code Snippets Manager" In the Tools menu (the shortcut is Ctr+k,ctrl+b), where you can view vs gives you all the code snippets built in
We can open any of the built-in code snippet files through the file path, then refer to the contents of the file, write a code snippet file, and then save the file with the. snippet file extension, and the filename is not duplicated.
After you have written the code snippet file, you can directly import your code into the appropriate folder (My code Snippets) via the code Snippet manager.
After the import is complete, you can go to the edit area and try it, if you enter the letter but not, you can restart the next vs try
NuGet
Everyone is used every day, so don't repeat it, click on it →→→nuget←←←
Team Foundation
Team Foundation Microsoft Home Code version Control tool, because the company Unified SVN, so there is no formal use of this feature, just casually open the experience of the next
Visual Studio * * * The first IDE of the universe, and then usually use a few features, if you have any unknown and practical vs skills, might as well shine out
Visual Studio Skill Get