Summary of common shortcut keys in IntelliJ IDEA

 When using IntelliJ Idea, using shortcut keys is essential. Mastering some commonly used shortcut keys can greatly improve our development efficiency. Some shortcut keys can be used proficiently, but there are other shortcut keys that are very useful, but because there is no usage habit or no understanding of the usage of shortcut keys, or even no concept of some shortcut keys before, they will not be used. . For these shortcut keys, if you can use them well, the efficiency of editing code will be improved to a higher level. So sort it out here, strengthen your use, and form a habit.

(Note: The shortcut keys of some operations have been changed, which are different from the default shortcut keys of IntelliJ Idea)

action hot key illustrate
Move Caret to Code Block End Ctrl+] For example, a code block enclosed by {}, use this shortcut key to quickly jump to the end of the code block
Move Caret to Code Block Start Ctrl+[ Same as above, quickly jump to the beginning of the code block
Complete Current Statement Ctrl+Shift+Enter Fill the input if, for, function, etc. with {} or ; to make the code statement complete
Start New Line Shift+Enter Start a new line below the current line
Start New Line Before Current Ctrl+Alt+Enter Insert a new line above the current line
Delete to Word End Ctrl+Delete Delete all characters from the cursor to the end of the word
Delete to Word Start Ctrl+BackSpace Delete all characters from the cursor to the beginning of the word
Move Caret to Previous Word Ctrl+Left Arrow move cursor to previous word
Move Caret to Next Word Ctrl+Right Arrow move cursor to next word
Scroll Up Ctrl+Up Arrow scroll up one line
Scroll Down Ctrl+Down Arrow scroll down one line
Extend Selection Ctrl+W select whole word
Toggle Case Ctrl+Shift+U switch case

———————————————Edit——————————————————–

action hot key illustrate
Undo Ctrl+Z revoke
Redo Ctrl+Shift+Z redo
Cut Ctrl+X cut
Copy Ctrl+C copy
Paste Ctrl+V paste
Join Lines Ctrl+Shift+J Merge selected lines into one line

—————-Find—————–

action hot key illustrate
Find Ctrl+F Find in current file
Replace Ctrl+R replace string
Find in Path Ctrl+Shift+F Find string in global file
Replace in Path Ctrl+Shift+R replace string in global
Find Usages Alt + F7 Find the use of the current variable and display it in a list
Show Usages Ctrl + Alt + F7 Find the use of the current variable and display the dialog directly
Find Usages in File Ctrl+F7 Find usage of symbols in files
Highlight Usages in File Ctrl+Shift+F7 Highlight the use of variables in the file

The frequency of shortcut keys here is still very high, but the most used ones are Ctrl+F and Ctrl+Shift+F. The later related Find Usages are basically not used, and they should be used more later, sometimes relative to Ctrl +F finds by string in the file, it is better to use

—————————————–Navigate————————————————

action hot key illustrate
Class… Ctrl+N Find class files
File… Ctrl+Shift+N find files
Line… Ctrl+G Navigate to a line in the file
Back Alt+Left Arrow Return to the last cursor position
Forward Alt+Right Arrow Return to the previous cursor position
Last Edit Location Ctrl+Shift+Backspace Return to last edit position
Next Edit Location Ctrl+Shift+Backslash Return to the last edit position
Declaration Ctrl+B Navigate to the location where the variable is defined
Implementation(s) Ctrl+Alt+B Navigate to the concrete implementation of the selected class or method
Type Declaration Ctrl+Shift+B 直接定位至光标所在变量的类型定义
Super Method Ctrl+U 直接定位至当前方法override或者implements的方法定义处
File Structure Ctrl+F12 显示当前文件的文件结构
File Path Ctrl+Alt+F12 显示当前文件的路径,并可以方便的将相关父路径打开
Type Hierarchy Ctrl+H 显示当前类的继承层次
Method Hierarchy Ctrl+Shift+H 显示当前方法的继承层次
Call Hierarchy Ctrl+Alt+H 显示当前方法的调用层次
Next Highlighted Error F2 定位至下一个错误处
Previous Highlighted Error Shift+F2 定位至前一个错误处
Previous Occurrence Ctrl+Alt+向上箭头 查找前一个变量共现的地方
Next Occurrence Ctrl+Alt+向下箭头 查找下一个变量共现的地方

目前还不知道Previous Occurrence 和 Next Occurrence是怎么用的,在变量上使用没有反应。不过在Edit–Find菜单下有几个菜单项:Find Next \/ Move to Next Occurrence、Find Previous \/ Move to Previous Occurrence等。当选中变量的时候,需要首先点击“Find Word at Caret”,然后再点击上述选项才有用

————————————————-Code———————————————–

动作 快捷键 说明
Override Methods… Ctrl+O 重写基类的方法
Implement Methods… Ctrl+I 实现基类或接口中的方法
Generate… Alt+Insert 产生构造方法、getter/setter等方法
Surround With… Ctrl+Alt+T 将选中的代码使用if、while、try/catch等包装
Unwrap/Remove… Ctrl+Shift+Delete 去除相关的包装代码

—————————————–Completion——————————————

动作 快捷键 说明
Basic Alt+/ 自动完成
SmartType Alt+Enter 自动提示完成

—————————————-Folding————————————————-

动作 快捷键 说明
Expand Ctrl+= 展开代码
Collapse Ctrl+- 收缩代码
Expand Recursively Ctrl+Alt+= 递归展开代码
Collapse Recursively Ctrl+Alt+- 递归收缩代码
Expand All Ctrl+Shift+= 展开所有代码
Collapse All Ctrl+Shift+- 收缩所有代码

———————————

动作 快捷键 说明
Insert Live Template Ctrl+J 插入Live Template
Surround with Live Template Ctrl+Alt+J 使用Live Template包装
Comment with Line Comment Ctrl+/ 使用//进行注释
Comment with Block Comment Ctrl+Shift+/ 使用/**/进行注释
Reformat Code Ctrl+Alt+L 格式化代码
Auto-Indent Lines Ctrl+Alt+I 自动缩进行
Optimize Imports Ctrl+Alt+O 优化import

———————————

动作 快捷键 说明
Move Statement Down Ctrl+Shift+向下箭头 将光标所在的代码块向下整体移动
Move Statement Up Ctrl+Shift+向上箭头 将光标所在的代码块向上移动
Move Element Left Ctrl+Alt+Shift+向左箭头 将元素向左移动
Move Element Right Ctrl+Alt+Shift+向右箭头 将元素向右移动
Move Line Down Alt+Shift+向下箭头 将行向下移动
Move Line Up Alt+Shift+向上箭头 将行向上移动

————————————-Refactor——————————————–

动作 快捷键 说明
Rename Shift+F6 重命名
Change Signature Ctrl+F6 更改函数签名
Type Migration Ctrl+Shift+F6 更改类型
转自。 https://blog.csdn.net/wei83523408/article/details/60472168

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324923562&siteId=291194637