一、个人设定内容:
命令内容 | 对应Keymap | Mac下我的快捷键自定义设定 |
---|---|---|
保存 | Main menu | File | Save All | command+s |
撤销 | Main menu | Edit | Undo | command+z |
回滚撤销 | Main menu | Edit | Redo | command+option+z |
剪切 | Main menu | Edit | Cut | command+x |
复制 | Main menu | Edit | Copy | command+c |
粘贴 | Main menu | Edit | Paste | command+v |
当前文件查找 | Main menu | Edit | Find | Find… | command+f |
当前文件替换 | Main menu | Edit | Find | Replace… | command+r |
全项目查找 | Main menu | Edit | Find | Find in Path… | command+shift+f |
全项目替换 | Main menu | Edit | Find | Replace in Path… | command+shift+r |
当前页选区全部 | Main menu | Edit | Select All | command+a |
对当前行复制一行到其下一行 | Main menu | Edit | Duplicate Line or Selection | command+d |
删除当前行 | Editor Actions | Delete Line | command+y |
查看方法/函数参数 | Main menu | View | Parameter Info | command+p |
跳转到选定方法被引用的位置 | Main menu | Navigate | Declaration or Usages | command+u |
查看被选定方法在整个项目的引用目录信息 | Main menu | Edit | Find | Find Usages | command+alt+u |
在当前类下生成构造/set/get/equals/toString等方法 | Main menu | Code | Generate… | command+g |
代码提示 | Main menu | Code | Completion | Basic | option+/ |
对单行代码标为注释 | Main menu | Code | Comment with Line Comment | command+/ |
对多行的代码块标为注释 | Main menu | Code | Comment with Block Comment | command+option+/ |
代码格式化 | Main menu | Code | Reformat Code | command+option+f |
整理引入,清理多余引入 | Main menu | Code | Optimize Imports | command+option+o |
抽取变量 | Main menu | Refactor | Extract | Introduce Variable… | command+option+v |
抽取方法 | Main menu | Refactor | Extract | Extract Method… | command+option+m |
运行代码 | Main menu | Run | Run | command+\ |
debug代码 | Main menu | Run | Debug | command+enter |
关闭当前页 | Main menu | Window | Editor Tabs | Close | command+w |
关闭当前页以外的其他页 | Main menu | Window | Editor Tabs | Close Others | command+shift+w |
对选定代码块设置包围(try/catch、if、while等) | Main menu | Code | Surround With… | command+t |
万能操作键(用于继承实现方法、先用类再创建类等) | Other | Show Context Actions | command+` |
基本形式的补全代码 | Main Menu | Code | Code Completion | Basic | alt+/ |
二、常用模板:
psvm:静态主方法
sout:输出语句
xxx.sout:输出xxx
soutv:输出最近的变量(variable)
soutm:输出所在的方法名称(method)
soutp:输出传入的参数(parameter)
fori:i的for循环
iter:增强for循环
itar:数组for循环
ritar:反向数组for循环
itli:list集合for循环
itco:迭代器for循环
itit:迭代器while循环
xxx.fori:对xxx正向for循环
xxx.forr:对xxx反向for循环
ifn:判断最近的变量是null么
inn:判断最近的变量不是null么
xxx.null:判断最近的变量是null么
xxx.nn:判断最近的变量不是null么