VS2010 快捷键

た 入场券 2021-12-17 14:41 521阅读 0赞

Keyboard Shortcuts

1. Alt-Shift-Enter to View Coding Window Full-screen

clip\_image001clip\_image003clip\_image004![clip_image003[1]][clip_image003_1_clip_image003_1]clip\_image005

Hitting “Alt+Shift+Enter” will make the coding window full-screen and (temporarily) drop most other windows from view. Restore to your usual window configuration by de-pressing the “Full Screen” button at top (the fact that it seems to be pushed up a little off-screen must be a VS2010 Beta 2 deal):

clip\_image007

2. Alt-F12 to Find Symbol

![clip_image001[1]][clip_image001_1_clip_image001_1]![clip_image003[2]][clip_image003_2_clip_image003_2]clip\_image008

Use “Alt-F12” to find symbols, objects, or members.

clip\_image010

3. Ctrl-F to do a Quick Find

clip\_image011![clip_image003[3]][clip_image003_3_clip_image003_3]clip\_image012

Search for something in the current code file quickly with “Ctrl-f”. clip\_image014

4. Ctrl-Shift-F to Find in Files

![clip_image011[1]][clip_image011_1_clip_image011_1]![clip_image003[4]][clip_image003_4_clip_image003_4]![clip_image004[1]][clip_image004_1_clip_image004_1]![clip_image003[5]][clip_image003_5_clip_image003_5]![clip_image012[1]]clip_image012_1_clip_image012_1

Find in files is easy with “Ctrl-Shift-f”. clip\_image016

5. Ctrl-K-C to Comment/Uncomment Code

![clip_image011[2]][clip_image011_2_clip_image011_2]![clip_image003[6]][clip_image003_6_clip_image003_6]![clip_image012[2]][clip_image012_2_clip_image012_2]![clip_image003[7]][clip_image003_7_clip_image003_7]clip\_image017

You can comment or uncomment code by highlighting the respective code block and hitting “Ctrl-k-c” to comment or “Ctrl-k-u” to uncomment. This shortcut even works in .aspx pages.

clip\_image019

clip\_image021

6. Ctrl-K-D to Reformat the Entire Document

![clip_image011[3]][clip_image011_3_clip_image011_3]![clip_image003[8]][clip_image003_8_clip_image003_8]clip\_image022![clip_image003[9]][clip_image003_9_clip_image003_9]clip\_image023

If you want to reformat all of the code in the current document, hit “Ctrl-k-d”.

7. Ctrl-K-F to Reformat a Block of Code

![clip_image011[4]][clip_image011_4_clip_image011_4]![clip_image003[10]][clip_image003_10_clip_image003_10]![clip_image022[1]][clip_image022_1_clip_image022_1]![clip_image003[11]][clip_image003_11_clip_image003_11]![clip_image012[3]]clip_image012_3_clip_image012_3

If you’ve just pasted in a bunch of code where the formatting is screwed-up, just highlight it and hit “Ctrl-k-f” to format.

8. Ctrl-K-L to Toggle Outlining Ctrl-M-M to Toggle Outlining

![clip_image011[5]][clip_image011_5_clip_image011_5]![clip_image003[12]][clip_image003_12_clip_image003_12] clip\_image024 ![clip_image003[13]][clip_image003_13_clip_image003_13] ![clip_image024[1]]clip_image024_1_clip_image024_1

If you want to open (expand) or close (collapse) all outlining in a code file, use “Ctrl-m-m”. It works like a toggle, alternatively expanding or collapsing all outlining in the current file.

9. Ctrl-K-S to Access Code Snippets

![clip_image011[6]][clip_image011_6_clip_image011_6]![clip_image003[14]][clip_image003_14_clip_image003_14]![clip_image022[2]][clip_image022_2_clip_image022_2]![clip_image003[15]][clip_image003_15_clip_image003_15]clip\_image025

Easily open the code snippets selection dropdown with “Ctrl-k-s”:

clip\_image027

10. Ctrl–K–T to View Call Hierarchy

![clip_image011[7]][clip_image011_7_clip_image011_7]![clip_image003[16]][clip_image003_16_clip_image003_16]![clip_image022[3]][clip_image022_3_clip_image022_3]![clip_image003[17]][clip_image003_17_clip_image003_17]clip\_image028

Highlight a member operation and hit “Ctrl-k-t” to view it’s call hierarchy.

clip\_image030

A new window will open:

clip\_image032

11. Ctrl-L to Cut Line to Clipboard

![clip_image011[8]][clip_image011_8_clip_image011_8]![clip_image003[18]][clip_image003_18_clip_image003_18]clip\_image033

It’s not necessary to highlight an entire line and then hit the delete key. Just hit “Ctrl-L” and the line the cursor is currently on will be removed and copied to the clipboard. “Ctrl-x” performs the same operation by default.

12. Ctrl-F3 to Search Without the Dialog

![clip_image011[9]][clip_image011_9_clip_image011_9]![clip_image003[19]][clip_image003_19_clip_image003_19]clip\_image034

![clip_image011[10]][clip_image011_10_clip_image011_10]![clip_image003[20]][clip_image003_20_clip_image003_20]![clip_image004[2]][clip_image004_2_clip_image004_2]![clip_image003[21]][clip_image003_21_clip_image003_21]![clip_image034[1]]clip_image034_1_clip_image034_1

Just highlight the text you want to search on and hit “Ctrl-F3” to search down or “Ctrl-Shift-F3” to search up.

13. Ctrl-, (Ctrl-Comma) to Perform a Fuzzy ‘Navigate To’ Search

![clip_image011[11]][clip_image011_11_clip_image011_11]![clip_image003[22]][clip_image003_22_clip_image003_22]clip\_image036

Perform a “fuzzy” search and get location information with “Ctrl-,” (Ctrl-Comma).

clip\_image038

14. Ctrl-] to Find Matching Curly Brace or Region

![clip_image011[12]][clip_image011_12_clip_image011_12]![clip_image003[23]][clip_image003_23_clip_image003_23]clip\_image039

Position the cursor next to a curly brace (‘{‘ or ‘}‘) and hit “Ctrl-}‘. This will toggle the cursor between the matching braces.

clip\_image041

This shortcut will also work for #region…#endregion’s.

15. F9 to Add/Remove Breakpoint

clip\_image042

‘F9’ will toggle breakpoints for the current line.

16. F12 to Go to Definition

![clip_image008[1]]clip_image008_1_clip_image008_1

Put the cursor on an item and hit ‘F12’. Instant ‘go to definition’ functionality.

17. Shift-F5 to Stop Debugging

![clip_image004[3]][clip_image004_3_clip_image004_3]![clip_image003[24]][clip_image003_24_clip_image003_24]clip\_image043

To stop debugging a project, use “Shift-F5”. Much quicker than going through the Debug menu.

18. Shift-F12 to Find Usages

![clip_image004[4]][clip_image004_4_clip_image004_4]![clip_image003[25]][clip_image003_25_clip_image003_25]![clip_image008[2]]clip_image008_2_clip_image008_2

‘Shift-F12’ will find all usages of the item the cursor is currently on and display the “Find Usages” dialog (this is ReSharper’s version of the dialog; standard VS2008 looks a little different):

clip\_image045

19. ‘prop’ to Create New Property

clip\_image047![clip_image003[26]][clip_image003_26_clip_image003_26]clip\_image048![clip_image003[27]][clip_image003_27_clip_image003_27]![clip_image048[1]]clip_image048_1_clip_image048_1

Add a new property in code by typing prop then hitting the Tab key twice. This “prop-TAB-TAB” combination will create a property template that looks like:

1: public int MyProperty { get; set; }

View Plain

Mouse Shortcuts

1. Right-click to add references

Say you’ve just entered a line of code like the following where the red squiggly indicates you haven’t yet added the necessary reference (in VS2010 Beta 2, the red squiggly isn’t showing up, but the shortcut still works):

clip\_image050

You could jump to the top of the file and type it in manually, or you could right-click on the squiggly-indicated word and choose “Resolve | using …”:

clip\_image052

This will add the needed reference for you, no typing required.

2. Zoom In/Zoom Out

![clip_image011[13]][clip_image011_13_clip_image011_13]![clip_image003[28]][clip_image003_28_clip_image003_28]clip\_image054

The same Word functionality of pressing Ctrl and zooming in and out is now in VS2010.

3. Remove unused references

Many times there are references included in the “using…” section that are not needed. Removing the unnecessary ones is easy: Right-click anywhere on the code file, select “Organize Usings | Remove Unused Usings”.

clip\_image056

4. Sort usings

To sort your “usings…” section, right-click anywhere on the code file and select “Organize Usings | Sort Usings”.

clip\_image058

5. Open a file’s “containing folder”

Right-click on an open file’s tab, select “Open Containing Folder”.

clip\_image060

6. Copy a file’s folder location to the clipboard

Right-click on an open file’s tab, select “Copy Full Path”.

clip\_image062

7. Close all files but “this” one

If you have more than one file open, you can right-click on one of the file tabs (the one which you want to stay open) and choose “Close All But This”. This will close all other files.

clip\_image064

8. Close tab

A quick way of closing a tab is to use the mouse scroll or middle button. Hover the mouse cursor over the tab, click the mouse scroll button, and the file (and it’s tab) will close.

9. Highlight References/Usages

Place the cursor on any member and VS2010 will auto-highlight it throughout:

clip\_image066

转载于:https://www.cnblogs.com/kungfupanda/p/3510960.html

发表评论

表情:
评论列表 (有 0 条评论,521人围观)

还没有评论,来说两句吧...

相关阅读

    相关 VS 快捷键

    ctrl + 左/右方向键 :光标向左/右移动一个单词; ctrl + shift + 左/右方向键 :选择一个单词; home 键 :光标回到行的第一个字母; en

    相关 VS快捷键

    vsc常用快捷键: 同时打开多个窗口(查看多个项目) 打开一个新窗口: Ctrl+Shift+N 关闭窗口: Ctrl+Shift+W 同时打开多个编辑器(查看多