首页 > 代码库 > 配置VS代码生成工具ReSharper快捷键

配置VS代码生成工具ReSharper快捷键

VS代码生成工具ReSharper提供了丰富的快捷键,可以极大地提高你的开发效率。安装ReSharper后首次启动Visual Studio时,会出现一个名为ReSharper Keyboard Scheme的对话框,如下图所示:

VS代码生成工具ReSharper使用手册:配置快捷键

选择对话框提供的三个选项之一后的任何时候,您可以配置单独的键盘快捷键。

配置单个键盘快捷键

1、在主菜单上,选择Tools | Options

2、在导航视图中选择Environment | Keyboard

3、在命令列表中,选择启动ReSharper的命令名称。浏览列表以查看或者编辑ReSharper的特定操作的键盘快捷方式。

在键盘快捷方式间切换或者恢复到当前选定方案的默认状态

1、在主菜单上,选择ReSharper | Options

2、选择Environment | Keyboard and Menus

3、在Keyboard and Menus选项卡上,选择 Visual Studio, ReSharper 2.x 或 IntelliJ IDEA或 None,点击Apply Scheme。如果你选择None,你可以在Visual Studio的本地选项菜单中定义任意一组自定义快捷键(Tools | Options | Environment | Keyboard) 。

完整的快捷键列表

代码分析(Code analysis)

CommandShortcut
(Visual Studio)
Shortcut
(IntelliJ IDEA/ReSharper 2.x)
Toggle code analysis in the current fileCtrl+Shift+Alt+8Ctrl+Shift+Alt+8
Go to next code issue (error, warning or suggestion)Alt+PgDnF12
Go to previous code issue (error, warning or suggestion)Alt+PgUpShift+F12
Go to next errorShift+Alt+PgDnAlt+F12
Go to next error in solutionShift+Alt+PgDnAlt+F12
Go to previous errorShift+Alt+PgUpShift+Alt+F12
Go to previous error in solutionShift+Alt+PgUpShift+Alt+F12
Inspect thisCtrl+Shift+Alt+ACtrl+Shift+Alt+A
View type hierarchyCtrl+E,HCtrl+Alt+H
Inspection Results windowCtrl+Alt+VCtrl+Alt+V

编码援助(Coding assistance)

CommandShortcut
(Visual Studio)
Shortcut
(IntelliJ IDEA/ReSharper 2.x)
Show action listCtrl+R,WCtrl+R,W
Paste multiple Ctrl+Shift+V 
Code cleanupCtrl+E,CCtrl+Alt+F 
Silent code cleanupCtrl+E,FCtrl+Shift+Alt+F
Symbol code completionCtrl+SpaceCtrl+Space
Smart code completionCtrl+Alt+SpaceCtrl+Shift+Space
Import symbol completionShift+Alt+SpaceCtrl+Alt+Space
Complete statementCtrl+Shift+EnterCtrl+Shift+Enter
Parameter informationCtrl+Shift+SpaceCtrl+P
Quick documentationCtrl+Shift+F1Ctrl+Q
Insert live templateCtrl+E,LCtrl+J
Surround with templateCtrl+E,UCtrl+Alt+J
Create file from templateCtrl+Alt+InsertCtrl+Alt+Insert
Generate codeAlt+InsertAlt+Insert
Move code upCtrl+Shift+Alt+UpCtrl+Shift+Alt+Up
Move code downCtrl+Shift+Alt+DownCtrl+Shift+Alt+Down
Move code leftCtrl+Shift+Alt+LeftCtrl+Shift+Alt+Left
Move code rightCtrl+Shift+Alt+RightCtrl+Shift+Alt+Right
Extend selectionCtrl+Alt+RightCtrl+W
Shrink selectionCtrl+Alt+LeftCtrl+Shift+W
Select containing declarationCtrl+Shift+[Ctrl+Shift+[
Duplicate a line or selectionCtrl+DCtrl+D
Comment with line commentCtrl+Alt+/Ctrl+/
Comment with block commentCtrl+Shift+/Ctrl+Shift+/

导航和搜索(Navigation and search

CommandShortcut
(Visual Studio)
Shortcut
(IntelliJ IDEA/ReSharper 2.x)
Go to typeCtrl+TCtrl+N
Go To FileCtrl+Shift+TCtrl+Shift+N
Go to file memberAlt+\Ctrl+F12
Go to symbolShift+Alt+TCtrl+Shift+Alt+N
Navigate ToAlt+`Ctrl+Shift+G
Go to type of symbolCtrl+Shift+F11Ctrl+Shift+T
Go to declarationF12Ctrl+B
Go to implementationCtrl+F12Ctrl+Shift+Alt+B
Go to base symbolsAlt+HomeCtrl+U
Go to derived symbolsAlt+EndCtrl+Alt+B
Go to usageShift+Alt+F12Ctrl+Alt+F7
Go to containing declarationCtrl+[Ctrl+[
Go to next member/tagAlt+DownAlt+Down
Go to previous member/tagAlt+UpAlt+Up
Find usagesShift+F12Alt+F7
Find usages (advanced)Ctrl+Shift+Alt+F12Shift+Alt+F7
Highlight usages in fileShift+Alt+F11Ctrl+Shift+F7
Go to previous usageCtrl+Alt+PgUpCtrl+Alt+Up
Go to next usageCtrl+Alt+PgDnCtrl+Alt+Down
Remove highlighting of usagesEscEsc
View recent filesCtrl+,Ctrl+E
View recent editsCtrl+Shift+,Ctrl+Shift+Alt+Backspace
Go to previous editCtrl+Shift+BackspaceCtrl+Shift+Backspace
Go to related filesCtrl+Alt+F7Ctrl+Shift+Alt+G
View bookmarksCtrl+`Ctrl+`
Go to a numbered bookmarkCtrl+[numeric key]Ctrl+[numeric key]
Set/remove a numbered bookmarkCtrl+Shift+[numeric key]Ctrl+Shift+[numeric key]
Find Results windowCtrl+Alt+F12Ctrl+Alt+U
File structureCtrl+Alt+FCtrl+F11
To-do itemsCtrl+Alt+D 
Stack Trace ExplorerCtrl+E,TCtrl+Shift+E
Locate in Solution ExplorerShift+Alt+LShift+Alt+L
Analyze referencesShift+Alt+YShift+Alt+Y

重构(Refactorings)

CommandShortcut
(Visual Studio)
Shortcut
(IntelliJ IDEA/ReSharper 2.x)
Refactor thisCtrl+Shift+RCtrl+Shift+R
RenameCtrl+R,RF2 or Shift+F6
MoveCtrl+R,OF6
Safe deleteCtrl+R,D or Alt+DelAlt+Del
Extract methodCtrl+R,MCtrl+Alt+M
Introduce variableCtrl+R,VCtrl+Alt+V
Introduce fieldCtrl+R,FCtrl+Alt+D
Introduce parameterCtrl+R,PCtrl+Alt+P
Inline variable/method/fieldCtrl+R,ICtrl+Alt+N
Encapsulate fieldCtrl+R,ECtrl+R,E
Change signatureCtrl+R,SCtrl+F6

单元测试(Unit testing)

CommandShortcut
(Visual Studio)
Shortcut
(IntelliJ IDEA/ReSharper 2.x)
Run unit testsCtrl+U,RCtrl+T,R
Debug unit testsCtrl+U,DCtrl+T,D
Run all tests in solutionCtrl+U,LCtrl+T,L
Run current test sessionCtrl+U,YCtrl+T,Y
Repeat previous test runCtrl+U,YCtrl+T,Y
Append to test sessionCtrl+U,ACtrl+T,A
Create new test sessionCtrl+U,NCtrl+T,N
Unit Test ExplorerCtrl+Alt+UCtrl+Alt+T
Unit Test SessionsCtrl+Alt+TCtrl+Alt+R

工具窗口(Tool windows)

CommandShortcut
(Visual Studio)
Shortcut
(IntelliJ IDEA/ReSharper 2.x)
File structureCtrl+Alt+FCtrl+F11
Find Results windowCtrl+Alt+F12Ctrl+Alt+U
Hierarchies windowCtrl+Alt+H 
Inspection Results windowCtrl+Alt+VCtrl+Alt+V
Stack Trace ExplorerCtrl+E,TCtrl+Shift+E
Templates Explorer windowAlt+R,PAlt+R,P
To-do itemsCtrl+Alt+D 
Unit Test ExplorerCtrl+Alt+UCtrl+Alt+T
Unit Test SessionsCtrl+Alt+TCtrl+Alt+R
Close recent toolCtrl+Shift+F4Ctrl+Shift+F4
Activate recent toolCtrl+Alt+BackspaceCtrl+Alt+Backspace

配置VS代码生成工具ReSharper快捷键