Coding kata with Java.
- 进入 Preference/Editor/Lice Templates
- 找到 Junit Test,并在 Junit Test 下创建 Live Template(我命名为 test,这样在需要创建测试方法时输入 “test” 按回车即可快速创建测试方法):
@Test
public void should_$NAME$(){
$END$
}
- 进入项目导航
command + 1
(文件导航) - 测试类与实现类之间快速跳转
command + shift + t
- 快速搜索 Class
command + n
然后键入 Class 的关键字 (输入 GN 可以找到并打开 GameNumber 类) - 查找最近编辑的文件
command + e
- 在项目/文件导航快速搜索
command + F1
- 关闭当前打开的文件
command + F4
- 查看最近查看的 tab 或文件
control + tab
- 光标跳转到指定行
command + g
- 光标定位到高亮的 Error:下一个
F2
,上一个shift + F2
- 光标定位到函数实现或调用
command + b
- 查看 IDEA 建议的修复代码错误或警告的操作
option + enter
=> 快速修复(Quick Fix) - 选择代码(逐级向上选择)
command + w
- 删除代码行
command + y
- 剪切代码行
command + x
- 复制代码行
command + d
- 上下移动光标所在代码行
option + shift + 方向键
- 光标移动到代码块的始末位置
command + [
,command + ]
- 选择代码块
command + shift + [
,command + shift + ]
- 将选中的代码或光标之后的代码合并到一行
control + shift + j
- 删除至单词起始或结束位置
option + del
,fn + option + del
- 选中文件或目录执行 RUN 或 DEBUG
shift + option + F10
- 执行上一次 RUN 执行的操作
shift + F10
: 例如上一次运行的测试操作,或上一次运行项目执行操作 - DEBUG 模式运行
shift + F9
- 提炼函数(Extract Method)
command + option + m
- 提炼变量(Extract Variable)
command + option + v
- 提炼字段(Extract Field)
command + option + f
- 内联(Inline)
command + option + n
函数、变量、字段或者参数 - 移动函数(Move Method)
F6
- 改名(Change Name)
shift + F6
- 改变签名(Change Signature)
command + F6
- 提交代码到本地 git 仓库
command + k
,填写 comment 后使用command + enter
提交 - 推送代码到远端 git 仓库
shift + command + k
,使用command + enter
提交