IntelliJ IDEA Live templates

作为从 eclipse 转战 idea 的人来说, 开始是痛苦的, 结局是美好的,
现在快捷键我还保留了eclipse 的习惯。
废话不多说, 进入今天的主题, 怎么样优雅的使用idea的功能。

Live templates 实时模板。

构建你自己的实时模板看图:
IntelliJ IDEA Live templates

具体怎么新建 请参考官方文档:
https://www.jetbrains.com/help/idea/template-variables.html#

首先我们来看下简单的:
psfs: public static final String

main or psvm : public static void main(String[] args){

}

sout : System.out.println();
IntelliJ IDEA Live templates

fori : for (int i = 0; i < ; i++) {

}

ifn :if (var == null) {

}

IntelliJ IDEA Live templates

这里还有还可以自己选择模板, 比如输入 for 时候, 很有多模板,可以Ctrl+Alt+J打开“选择模板”弹出窗口 如下:
IntelliJ IDEA Live templates

这里不光只能设置java 文件,可以设置所有文件, 真香!!!…

IntelliJ IDEA Live templates