IDEA 快捷键
写在前面
此文档记录在使用 IDEA 过程中经常需要使用到的快捷键。
在家里用 macOS,在公司使用 Windows,IDEA 在两个系统中的快捷键都是单独的,所以该文档中针对某一功能快捷键的记录会有两个版本,如下:
Forward
ctrl + alt + 右
下一个光标停留位置
cmd + opt + 右
cmd + ]
上面的文章片段的组成部分:
- 标题是 IDEA 中设置的英文名称
- 第一行为 Windows 系统的快捷键映射
- 第二行的中文为该快捷键的中文描述,使用该描述来分隔 Windows 快捷键和 macOS 快捷键
- 第三行为 macOS 系统的快捷键映射
- 第四行为 macOS 上面的快捷键映射(在 IDEA 中一个功能可以映射给多个快捷键)
快捷键记录
一、Editor Actions
Split Line
ctrl + enter
光标位置处回行。如果光标未在行末,则将光标后的字符移到下一行
Column Selection Mode
alt + shift + insert
多行编辑模式
Toggle Case
ctrl + shifit + U
大小写切换
Delete Line
ctrl + Y
删除行
cmd + backspace
Duplicate Line or Selection
ctrl + D
复制行或选中项
cmd + D
Move Caret to Code Block Start
将光标移动到代码块开头位置
ctrl + [
Move Caret to Code Block End
将光标移动到代码块结束位置
ctrl + ]
二、Main Menu
File
Settings Actions
Project Structure
ctrl + shift + alt + S
打开项目结构
cmd + ;(分号)
Settings
ctrl + alt + S
打开IDEA设置
command + ,
View
View Recent Actions Group
Recent Locations
ctrl + shift + E
弹窗出现最近鼠标定位位置列表,其中还可以选择是否只展示做了更改的位置。只需要在出现的弹窗里面再次点击该快捷键就可以进行切换
Quick Documentation
ctrl + Q
快速查看查看类等文件的注释文档
control + J
control + 鼠标中键点击
Code Editor View Actions
Parameter Info
ctrl + P
查看方法的参数信息
command + P
Refactor
refactor this…
打开修改文件选项
ctrl + alt + shift + T
Move…
移动文件
F6
Copy…
拷贝文件
F5
Rename
重命名文件
shift + F6
change signature…
修改类泛型签名
ctrl + F6
Navigate
Navigate in File
next Method
alt + 方向下键
下一个方法
control + shift + 方向键下
previous Method
alt + 方向上键
上一个方法
control + shift + 方向键上
Goto by Reference Actions
Go to Declaration or Usages
ctrl + B
跳转到声明处或使用处
cmd + B
Hierarchy Actions
Type Hierarchy
ctrl + H
打开类层次结构
control + H
Go to Type Declaration
ctrl + shift + B
ctrl + shift + 鼠标左键点击
跳转到类型声明。比如类中声明了一个属性,在方法中引用,可以直接通过该快捷键从引用属性的位置直接跳转到该属性的类中。
Go to Super Method
ctrl + U
跳转到父类或父方法
cmd + U
Go to Implementation(s)
ctrl + alt + B
跳转到实现位置
Select in …
在某一个窗口查看该文件
窗口包括:Project View,File Structure,文件资源管理器等
alt + F1
Goto by Name Actions
Go to Class
ctrl + N
弹窗搜索类
request service
查找请求接口
ctrl + alt + /
Goto by Reference Actions
Go to Test
ctrl + shift + T
选择当前类的测试类或创建当前类的测试类
Back
上一个光标停留位置
ctrl + alt + 左
cmd + opt + 左
cmd + [
Forward
ctrl + alt + 右
下一个光标停留位置
cmd + opt + 右
cmd + ]
Windows
Editor Tabs
Editor Close Actions
close tab
ctrl + F4
关闭标签页
cmd + w
select next tab
切换到下一个标签
alt + 右
control + 右
select previous tab
切换到上一个标签
alt + 左
control + 左
Code
Generate
alt + Insert
新建文件
command + N
control + enter
Code Completion
代码补全
Basic
基础的代码补全
ctrl + 空格
Code Formatting Actions
reformat code
ctrl + alt + L
格式化代码
可以部分代码格式化,选中代码之后执行代码格式化,就只会格式化选中代码
move line down
将行向下移动
opt + shift + 方向下键
move line up
将行向上移动
opt + shift + 方向上键
move statement down
将代码块向下移动
cmd + shift + 方向下键
move statement up
将代码块向上移动
cmd + shift + 方向上键
Run
Run/Debug
Run
运行
control + R
Debug
debug
control + D
Run…
运行某一个东西
control + opt + R
Debug…
debug 某一个东西
control + opt + D
Debugger Actions
Debugging Actions
Step Over
跳转到下一步
F8
Resume Program
跳转到下一个断点
F9
Edit
Cut/Copy/Paste Actions
Paste
Paste from History
ctrl + shift + V
ctrl + shift + insert
从复制剪切历史中粘贴
Git
VCS Group
Git
Rollback
ctrl + alt + Z
撤销更改
command + opt + Z
Update Project
ctrl + T
从VCS更新项目
command + T
三、Tool Windows
四、Other
Second Basic Completion
ctrl + alt + space
可能是为了防止 [[IDEA 快捷键#Basic]] 快捷键的冲突而另外单独设定的快捷键
Toggle Rendered View
ctrl + alt + Q
源码中注释切换阅读视图
control + opt + Q
Render All Doc Comments
ctrl + alt + shift + Q
将文件中所有的注释切换为阅读视图
自己设置的快捷键,mac 上面暂时没有设置,因为快捷键跟那个退出登录和锁定屏幕的快捷键有点像
control + opt + shift + Q
Load Changes
ctrl + shift + O
更改POM之后,载入maven更改
command + shift + I
No newline at end of file
相关链接
OB links
OB tags
#IDEA #IDE