此文章针对的是 Mac 版的2016.2.4 idea ,大部分的快捷键与旧版本的 idea 是相同的,大家请自行对比,以下快捷键只列举了工作当中最常用的。
内容编辑
option + enter:代码修复(用得最多)command + J:常用代码片段,例如:if(obj==null){},for(int i =0;i<;i++){}等command + N:代码生成,例如:Getters, Setters, Constructors, hashCode/equals等control + O:方法重写control + I:方法实现(一般情况下不需要,但是在java8中的接口可以使用default关键中,就起到使用了)command + option + T:把选中的代码采用((if..else, try..catch, for, synchronized, etc.)包起来使用command + /:行级注释,与解除注释(//注释)command + option + /:块级注释,与解除注释(/注释/)option + 向上箭头:将选中的代码块递增选中option + 向下箭头:将选中的代码块递减选中command + option + L:代码格式化command + X:剪切当前行或者是选中的代码块command + C:复制当前行或者是选中的代码块command + shift + V:选择要粘贴的代码command + D:重复复制当前行或者代码块command + delete:删除当前行command + shift + enter:在当前光标的下一行开头进行编辑command + option + enter:在当前光标的上一行开头进行编辑command + shift + U:大小写转换command + W:关闭当前编辑文件command + [-,+]:折叠或者是展开代码块command + shift + [-,+]:折叠或者是展开所有代码块
搜索/替换
command + F:搜索command + G:显示下一个搜索到的内容command + shift + G:显示上一个搜索到的内容command + R:内容替换command + shift + F:在当前环境搜索command + shift + R:在当前环境替换
使用搜索
option + F7:搜索当前内容被哪个文件引用command + F7:在当前文件搜索相同内容command + option + F7:显示被引用内容的语句
编译与运行
command + F9:编译项目command + shift + F9:编译当前文件control + option + R:选择运行程序control + option + D:选择调试程序control + R:运行程序control + D:调试程序
调试
F8:步过F7:步入shift + F8:跳出shift + F7:智能步入option + F9:运行到光标command + option + R:恢复程序command + F8:切换断点(打断点或取消)command + shift + F8:查看断点
导航
command + O:查找Classcommand + shift + O:查找文件command + option + O:可查找文件及方法ESC:从导航窗口跳至编辑窗口command + L:跳至某行某列command + E:弹出最近用的文件command + option + [左右箭头]:跳转至上一个或下一下编辑文件窗口command + B:去方法声明处command + option +B:去方法实现处command + Y:查看定义的方法体command + U:转至父类方法或类command + F12:查看文件结构control + H:查看类型层次结构(LocalDate -> Object)command + shift + H:查看方法层次结构control + option + H:查看方法调用结构F2:定位下一个错误文件或错误行shift + F2:定位上一个错误文件或错误行F4 / command + 向下箭头:编辑源文件F3:书签option + F3:增强记忆书签command + F3:查看所有书签
重构
F5:复制文件F6:移动文件command + Delete:彻底删除文件shift + F6:修复文件名command + option + N:把方法内联进来command + option + M:提取方法command + option + V:提取变量command + option + F:提取字段command + option + C:提取构造方法command + option + P:提取参数
常规
command + S:保存全部command + ,:打开系统设置command + ;:打开项目结构窗口
本文提供了IntelliJ IDEA 2016.2.4版本在Mac平台上的常用快捷键总结,覆盖内容编辑、搜索替换、编译运行、调试、导航和重构等方面,帮助开发者提高工作效率。
2253

被折叠的 条评论
为什么被折叠?



