跳至主要內容

Intellij idea高效使用教程

xlc520IDEAIDEA大约 11 分钟约 3181 字

Intellij idea 高效使用教程

一. 安装插件

1. Codota 代码智能提示插件

Intellij idea高效使用教程
Intellij idea高效使用教程

只要打出首字母就能联想出一整条语句,这也太智能了,还显示了每条语句使用频率。

原因是它学习了我的项目代码,总结出了我的代码偏好。

Intellij idea高效使用教程
Intellij idea高效使用教程

如果让它再加上机器学习,人工智能写代码的时代还会远吗?

2. Key Promoter X 快捷键提示插件

Intellij idea高效使用教程
Intellij idea高效使用教程

每次都会在右下角弹窗提示,帮助我们快速熟悉快捷键。

3. CodeGlance 显示代码缩略图插件

Intellij idea高效使用教程
Intellij idea高效使用教程

当代码很多的时候,方便查看,很有用。

4. Lombok 简化臃肿代码插件

Intellij idea高效使用教程
Intellij idea高效使用教程

实体类中的 get/set/构造/toString/hashCode 等方法,都不需要我们再手动写了

5. Alibaba Java Coding Guidelines 阿里巴巴代码规范检查插件

Intellij idea高效使用教程
Intellij idea高效使用教程

会按照阿里 Java 开发手册上规范帮我们检查代码,然后对代码做不同颜色展示,鼠标放上去,会看到提示内容,帮助我们写出更规范的代码。

6. CamelCase 驼峰命名和下划线命名转换

Intellij idea高效使用教程
Intellij idea高效使用教程

这几种风格的命名方式,用快捷键 ⇧ + ⌥ + U / Shift + Alt + U 可以进行快速转换,当我们需要修改大量变量名称的时候很方便。

7. MybatisX 高效操作 Mybatis 插件

Intellij idea高效使用教程
Intellij idea高效使用教程

8. SonarLint 代码质量检查插件

Intellij idea高效使用教程
Intellij idea高效使用教程

提示我不要用 System.out 输出,要用 logger 输出,诸如此类,帮助我们提升代码质量。

9. Save Actions 格式化代码插件

Intellij idea高效使用教程
Intellij idea高效使用教程

可以帮忙我们优化包导入,自动给没有修改的变量添加 final 修饰符,调用方法的时候自动添加 this 关键字等,使我们的代码更规范统一。

10. CheckStyle 代码风格检查插件

功能跟 Alibaba Java Coding Guidelines 类似

11. Grep Console 自定义控制台输出格式插件

Intellij idea高效使用教程
Intellij idea高效使用教程

12. MetricsReloaded 代码复杂度检查插件

Intellij idea高效使用教程
Intellij idea高效使用教程

13. Statistic 代码统计插件

Intellij idea高效使用教程
Intellij idea高效使用教程

14. Translation 翻译插件

Intellij idea高效使用教程
Intellij idea高效使用教程

15. Rainbow Brackets 彩虹括号插件

Intellij idea高效使用教程
Intellij idea高效使用教程

成对儿的括号显示相同的颜色,有了这个插件,我的近视都好了。

二. 自定义创建 live template,快速写代码

Intellij idea高效使用教程
Intellij idea高效使用教程

只要输入apr,就能自动提示,并且生成Autowired语句了。可以根据自己的代码习惯,自定义一些代码模板,帮助我们快速写代码。

Intellij idea高效使用教程
Intellij idea高效使用教程

三. 修改全局配置,提升工作效率

1. 优化导包配置

Intellij idea高效使用教程
Intellij idea高效使用教程

2. 取消 tab 页单行显示

Intellij idea高效使用教程
Intellij idea高效使用教程
Intellij idea高效使用教程
Intellij idea高效使用教程

多行显示更多的文件,方便查看。

3. 双斜杠注释改成紧跟代码头

Intellij idea高效使用教程
Intellij idea高效使用教程
Intellij idea高效使用教程
Intellij idea高效使用教程

4. 选中复制整行

Intellij idea高效使用教程
Intellij idea高效使用教程
Intellij idea高效使用教程
Intellij idea高效使用教程

原本只会复制你选中的代码,改完配置后,就能复制整行,无论你是否完全选中。

5. 取消匹配大小写

Intellij idea高效使用教程
Intellij idea高效使用教程

取消勾选后,输入小写 s,也能提示出 String

6. 优化版本控制的目录颜色展示

Intellij idea高效使用教程
Intellij idea高效使用教程

7. 创建文件时,自动生成作者和时间信息

Intellij idea高效使用教程
Intellij idea高效使用教程

8 . 显示行号和方法分割线

Intellij idea高效使用教程
Intellij idea高效使用教程

你还知道哪些关于 Intelij idea 高效操作或插件,一起在评论区分享吧!

IDEA 必备 20 款插件

以下插件已经为大家下载打包了,如果 IDEA 版本不一致的话,部分插件可能无法安装,可以根据我提供的地址自行下载相应插件: 插件打包下载地址:https://www.lanzouw.com/iV3XKwvq2deopen in new window

Leetcode Editor

这是一个上班摸鱼神器,也是一个可以在 IDEA 中刷算法题目的插件,有很多题目供我们学习, 表面在写代码,其实是在刷题。每道题都有很详细的解题思路 插件下载地址:https://plugins.jetbrains.com/plugin/12132-leetcode-editoropen in new window

Jrebel

这个插件真的是强烈推荐,有时候改一点点代码都要重启才能生效,很浪费时间。 有了这个插件,修改代码之后不需要重启也能生效。尤其跟别的同事联调的时候特别爽! 热部署插件,这个插件是收费的,但是可以免费激活, 访问这个https://www.guidgen.comopen in new window 网址生成一个 GUID,然后将生成的 ID,拼接到下面的 URL 中,粘贴到激活界面就可以啦 插件下载地址:https://plugins.jetbrains.com/plugin/4441-jrebel-and-xrebel-for-intellijopen in new windowhttps://jrebel.qekang.com/你生成的open in new window ID

Background Image Plus

一个设置背景图片的插件,有时候纯黑或者纯白看腻的话,可以使用这个插件自定义背景图片。 也支持动态的更换壁纸 插件下载地址:https://plugins.jetbrains.com/plugin/8502-background-image-plusopen in new window

Codota

IDEA 的自动补全功能已经很强大了,但是这个插件的自动补全功能更加强大,这是一个基于 AI 技术,学习了大量的开源项目,智能提示更加的可靠 插件下载地址:https://plugins.jetbrains.com/plugin/7638-codota-ai-autocomplete-for-java-and-javascriptopen in new window 有绿色图标的就是 codota 自动提示的代码

还有个更强的功能是,它可以从 github、stackoverflow 上快速的找到你想要的相关代码

EasyCode

这个插件真的特别强大,它可以通过数据库表自动的生成实体类、Controller、Dao、Service、mapper,简单而且强大。 通过 IDEA 内置的数据库,在对应的表中右键选择 easy code- generate Code,然后选择路径,勾选想要生成的代码就可以啦 插件下载地址:https://plugins.jetbrains.com/plugin/10954-easy-codeopen in new window

Translation

这是翻译插件,阅读源码有不认识的英文,或者编写变量时,不知道英文怎么写的时候可以直接进行翻译 在菜单栏上也可以直接进行翻译,不用再去打开一些在线翻译网站了 插件下载地址:https://plugins.jetbrains.com/plugin/8579-translationopen in new window

Key Promoter X

一个可以让你慢慢脱离鼠标操作的插件,在 IDEA 中操作时,他会将对应的快捷键,进行提示。 并且右侧会有一个列表,将你近期使用的功能进行展示,对于高频操作我们可以使用快捷键,这样可以提升效率 插件下载地址:https://plugins.jetbrains.com/plugin/9792-key-promoter-xopen in new window

Maven Helper

插件下载地址:https://plugins.jetbrains.com/plugin/7179-maven-helperopen in new window 安装之后,在 pom 文件中会多出一个 Dependcy Analyzer 选项卡

Conflicts:显示冲突依赖 All Dependencies as List:以列表形式显示依赖 All Dependencies as Tree:以树的形式显示依赖 遇到冲突的依赖,可以点击右键,跳到源文件或者直接选择 Exclude 排除这个依赖

Alibaba Java Coding Guidelines

阿里巴巴开发的一款插件,可以扫描代码中可能存在的问题 插件下载地址:https://plugins.jetbrains.com/plugin/10046-alibaba-java-coding-guidelinesopen in new window

将不符合规约的代码按 Blocker/Critical/Major(崩溃/严重/重要 ) 三个等级显示在下方,双击可以定位至代码处,右侧窗口还有针对代码的批量修复功能。

CodeGlance

用过 sublime 的同学对这个功能一定很熟悉,它是一个迷你缩放图插件 当代码过长的时候可以使用这个插件,相比如下拉框,这个插件更加的直观和方便 插件下载地址:https://plugins.jetbrains.com/plugin/7275-codeglanceopen in new window

GsonFormat

这是一个将 Json 字符串自动转换成实体类的插件 安装完插件之后,在实体类中使用快捷键 'alt+insert',mac 是‘control + 回车’选择 GsonFormat 插件下载地址:https://plugins.jetbrains.com/plugin/7654-gsonformatopen in new window

JavaDoc

这是一个快速生成文档注释的插件 插件下载地址:https://plugins.jetbrains.com/plugin/7157-javadocopen in new window windows 上可以通过 alt + insert 快捷键,mac 是 control+回车 可以快速生成注释模板

ignore

我们在使用 git 提交项目的时候,有时候会把 .idea 文件提交上去, 这个文件只是一些历史记录,版本信息。完全不用提交。 插件下载地址:https://plugins.jetbrains.com/plugin/7495--ignoreopen in new window 这个时候可以使用 ignore 这个插件,去配置 在 File- new - .ignore File· 中选择 gitignore File(Git) 选择 Example user template,右侧面板表示要忽略的文件,点击 Generate

Rainbow Brackets

这个插件主要是让我们代码中的括号变成彩虹颜色的括号,除了好看还可以帮我们分清括号,防止错乱 插件下载地址:https://plugins.jetbrains.com/plugin/10080-rainbow-bracketsopen in new window

AceJump

插件下载地址:https://plugins.jetbrains.com/plugin/7086-acejumpopen in new window 这是一个快速光标跳转的插件,可以很大的减少我们使用鼠标的频率 可以查看他的激活快捷键 比如我的是 ctrl + 分号,

激活之后,输入你想跳转的字符,比如 O 键,那么当前界面的 O 都会打上标签,再输入相应的字母跳转到对应的位置

按向上的键,可以行选定,方法跟上面的一致。 按左右键,是选择开头和结尾 RestfulTool 这是一个接口测试工具, 插件下载地址:https://plugins.jetbrains.com/plugin/14280-restfultoolopen in new window 安装成功之后在右侧会有一个 RestfulTool 的选项卡,点击之后会显示出当前项目的所有请求地址 并且支持各种各样的请求类型

Material Theme UI

插件下载地址:https://plugins.jetbrains.com/plugin/8006-material-theme-uiopen in new window 这是一款不错的主题插件,颜值非常的高,安装之后重启即可生效 可以在设置中,对一些细节,比如调整字体、大小、行间距等

GenerateAllSetter

插件下载地址:https://plugins.jetbrains.com/plugin/9360-generateallsetter/versionsopen in new window 这个插件可以快速的对实体类生成 set 代码,这样就不用我们一个一个的去手动 set 了 使用方法也非常简单,当我们 new 一个对象的时候,在对象上使用快简介"alt + 回车" 选择 Generate all setter with default value 就可以自动生成所有 set 方法啦

Statistic

一款分析项目代码的工具,按照扩展名列出清单,统计代码数量和行数 点击具体的类别,比如 Java,可以统计总行数,有效代码行数,注释行数,以及有效代码比重 插件下载地址:https://plugins.jetbrains.com/plugin/4509-statisticopen in new window

Free MyBatis plugin

插件下载地址:https://plugins.jetbrains.com/plugin/8321-free-mybatis-pluginopen in new window 在使用 mybatis 时,它可以通过 mapper 接口中的方法,直接跳转到 mapper.xml 文件中, 同样也可以从 mapper.xml 跳转到 mapper 接口中 非常实用!

Stop Coding

插件下载地址:https://plugins.jetbrains.com/plugin/15740-stopcodingopen in new window 最后推荐大家一下防沉迷代码的插件,如果你也经常沉迷于写代码,忘了起身休息喝水,那么试试这个插件吧

当写代码到设定的时间时,它会弹出下框进行提醒,当然,这个框是关不掉的.只有你休息了足够的时间它才会自动关闭.