【Java愚公】IDEA常用快捷键

IDEA常用快捷键

功能快捷键

  • 执行(run) alt + r
  • 提示补全 (Class Name Completion) alt + /
  • 单行注释 ctrl + /
  • 多行注释 ctrl + shift + /
  • 向下复制一行 (Duplicate Lines) ctrl + alt + down
  • 删除一行或选中行 (delete line) ctrl + d
  • 向下移动行(move statement down) alt + down
  • 向上移动行(move statement up) alt + up
  • 向下开始新的一行(start new line) shift + enter
  • 向上开始新的一行 (Start New Line before current) ctrl + shift + enter
  • 如何查看源码 (class) ctrl + 选中指定的结构ctrl + shift + t
  • 万能解错/生成返回值变量 alt + enter
  • 退回到前一个编辑的页面 (back) alt + left
  • 进入到下一个编辑的页面(针对于上条) (forward) alt + right
  • 查看继承关系(type hierarchy) F4
  • 格式化代码(reformat code) ctrl + shift + F
  • 提示方法参数类型(Parameter Info) ctrl + alt + /
  • 复制代码 ctrl + c
  • 撤销 ctrl + z
  • 反撤销 ctrl + y
  • 剪切 ctrl + x
  • 粘贴 ctrl + v
  • 保存 ctrl + s
  • 全选 ctrl + a
  • 选中数行,整体往后移动 tab
  • 选中数行,整体往前移动 shift + tab
  • 查看类的结构:类似于 eclipse 的 outline ctrl + o
  • 重构:修改变量名与方法名(rename) alt + shift + r
  • 大写转小写/小写转大写(toggle case) ctrl + shift + y
  • 生成构造器 /get/set/toString alt + shift + s
  • 查看文档说明(quick documentation) F2
  • 收起所有的方法(collapse all) alt + shift + c
  • 打开所有方法(expand all) alt + shift + x
  • 打开代码所在硬盘文件夹(show in explorer) ctrl + shift + x
  • 生成 try-catch 等(surround with) alt + shift + z
  • 局部变量抽取为成员变量(introduce field) alt + shift + f
  • 查找/替换(当前) ctrl + f
  • 查找(全局) ctrl + h
  • 查找文件 double Shift
  • 查看类的继承结构图(Show UML Diagram) ctrl + shift + u
  • 查看方法的多层重写结构(method hierarchy) ctrl + alt + h
  • 添加到收藏(add to favorites) ctrl + alt + f
  • 抽取方法(Extract Method) alt + shift + m
  • 打开最近修改的文件(Recently Files) ctrl + E
  • 关闭当前打开的代码栏(close) ctrl + w
  • 关闭打开的所有代码栏(close all) ctrl + shift + w
  • 快速搜索类中的错误(next highlighted error) ctrl + shift + q
  • 选择要粘贴的内容(Show in Explorer) ctrl + shift + v
  • 查找方法在哪里被调用(Call Hierarchy) ctrl + shift + h

代码快捷键

  • psvm : 可生成 main 方法
  • sout : System.out.println() 快捷输出

类似的:
soutp => System.out.println("方法形参名 = " + 形参名);
soutv => System.out.println("变量名 = " + 变量);
soutm => System.out.println(“当前类名.当前方法”);
“abc”.sout => System.out.println(“abc”);

  • fori : 可生成 for 循环

类似的:
iter:可生成增强 for 循环
itar:可生成普通 for 循环

  • list.for : 可生成集合 list 的 for 循环

例如:List list = new ArrayList();
输入: list.for 即可输出
for(String s:list){
}
又如:list.fori 或 list.forr

  • ifn:可生成 if(xxx = null):
  • inn:可生成 if(xxx != null) 或 xxx.nn 或 xxx.null
  • prsf:可生成 private static final
  • psf:可生成 public static final
  • psfi:可生成 public static final int
  • psfs:可生成 public static final String
  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Java愚公

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值