IntelliJ IDEA添加的常用Live Templates

1、路径 File | Settings | Editor | Live Templates

IntelliJ IDEA添加的常用Live Templates

 2、添加myGroup组在下面创建动态模板,下图已经创建好了

IntelliJ IDEA添加的常用Live Templates

 3、创建组里的模板

IntelliJ IDEA添加的常用Live Templates

IntelliJ IDEA添加的常用Live Templates

IntelliJ IDEA添加的常用Live Templates

3.1    /*         不知道为啥$params$不起作用

/**
 * description
 * @date $date$ $time$
 * @params $params$
 * @return $return$
 */

3.2    do

do {
    // TODO
} while (false);

3.3    main    $start$光标最后定位的地方

public static void main(String[] args) {
    $start$
}

3.4    method

private void $start$() {
    
}

3.5    switch

switch ($param$) {
    case a:
        // TODO
        break;
    default:
        break;
}

3.6    syse

System.err.println($start$);

3.7    syso

System.out.println($start$);

例:看个人喜好,怎么设置值随自己!(可以用快捷键Ctrl+Alt+M,该快捷键只能在方法中且选中的行有代码的情况下可用)

IntelliJ IDEA添加的常用Live Templates

IntelliJ IDEA添加的常用Live Templates