IDEA配置优化

来源:互联网 发布:php登陆后跳转页面 编辑:程序博客网 时间:2024/06/06 05:49

原文地址:http://blog.csdn.net/hw1287789687/article/details/51058346

IDEA 配置优化,提高开发效率

去掉烦人的indent提示

ident 提示 
如何去掉呢? 
打开IDEA 的preferences|Editor|Code Style, 
去掉下图中的两个勾选: 
去掉勾选

设置文件的模板

我们创建一个java文件时,会在类的上面自动添加注释,包括作者和日期. 
其实我们可以定制这个自动添加的注释: 
修改模板

原来是这样的: 
这里写图片描述 
修改为: 
这里写图片描述

定制自己的snippet

snippet就是代码片段 
用过eclipse的同学都知道,我们输入Sysout就会自动转换为:

System.out.println();
  • 1

演示eclipse 
其实IDEA 也有相同的功能: 
自定义snippet

添加自定义文件类型

IDEA中没有jsp,所以我手动添加JSP: 
添加自定义类型的文件
下面附上JSP的模板:

<%@ page language="java" contentType="text/html; charset=UTF-8"         pageEncoding="UTF-8" %><%    String path = request.getContextPath();    String basePath = request.getScheme() + "://"            + request.getServerName() + ":" + request.getServerPort()            + path + "/";    if (path.equals("/")) {        path = "";    }%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head>    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">    <link rel="stylesheet" type="text/css" href="<%=path%>/static/css/global.css">    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">    <meta name="viewport"          content="width=device-width, initial-scale=1.0, maximum-scale=1">    <script type="text/javascript" src="http://hbjltv.com/static/js/jquery-1.11.1.js"></script>    <title>#[[$Title$]]#</title></head><body>#[[$END$]]#</body></html>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28

去掉框架检查提示

这里写图片描述 
如何去掉框架的检查提示呢? 
去掉勾选

Code completion case sensitivity

By default IntelliJ IDEA code completion case sensitivity only affects the first letter you type. This strategy can be changed in the Settings/Preferences dialog, Editor | General | Code Completion, so you can make to either make the IDE sensitive to all letters or make it insensitive to the case at all, based on what better fits your preferences. 
改为不区分大小写: 
不区分大小写

解决mac IDEA控制台中文乱码

控制台中文乱码
解决方法: 
这里写图片描述 
设置JAVA_TOOL_OPTIONS变量

JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8
  • 1

注意:下面的四个,每个都得手动设置一次: 
这里写图片描述 
解决之后: 
中文不再乱码
参考:idea 控制台输出 中文乱码 解决方法

隐藏IDEA cast unchecked警告

这里写图片描述

未保存的文件标识出

这里写图片描述


原创粉丝点击