idea设置教程_设置支付顺序

idea (53) 2023-03-24 22:04

大家好,我是编程小6,很高兴遇见你,有问题可以及时留言哦。

前言

程序员对待IDE都是虔诚的,经常因为谁是最好的IDE而在江湖上掀起波澜,曾经我也是。

后来我遇到了IDEA,从此是它,余生都是它。

IDEA 毫无疑问是目前最强大的Java开发工具了,但是大部分的人并没有将它用到极致,很多实用的配置,插件,小技巧被忽视。就像JDK8的新特性一样,你知道它在且坚持不用,但是只要用过一次就知道什么是真滴香。

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第1张

IDEA 软件设置Settings页面

Settings是对软件本身的一些属性进行配置,例如字体 主题 背景图 插件等。

如何打开Settings设置页面

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第2张

Settings设置页面结构详解

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第3张

结构

  1. Appearance & Behavior 外观和行为
  2. Keymap 快捷键
  3. Editor 编辑器设置
  4. Plugins 插件
  5. Version Control 版本控制
  6. Build,Execution,Deployment 构建,执行,部署
  7. Languages & Frameworks 语言和框架
  8. Tools 工具集

IDEA 常见的26个设置

绝大部分的设置都包含效果示意图,文章结构:设置方法-->效果示意图

Appearance & Behavior 外观和行为

设置主题

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第4张

目前我的IDEA中有两套主题:Darcula, IntelliJ。

  • Darcula 就是神秘的黑色主题,我偏爱黑色
  • IntelliJ 白色主题

设置菜单字体

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第5张

Keymap 快捷键

设置为Eclipse快捷键的键位

如果对 Eclipse 难以忘怀可以使用其键位,这种操作我也不推荐,感觉别扭。

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第6张

修改快捷键

不要一次性修改大量的快捷键

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第7张

  • Add keyboard Shortcut 添加键盘快捷键 实际上就是修改当前的键位
  • Add Mouse Shortcut 增加鼠标捷径
  • Add Abbreviation
  • Remove Ctrl+Alt+Shift+S 移除改快捷键

查看快捷键的功能

通过快捷键 查找快捷键的功能,例如:你不知道 Ctrl+F什么意思 可以通过该功能进行搜索

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第8张

Editor 编辑器设置

Editor 中的设置可以说是最高频使用的设置了,编辑区的字体,自动导包,注释生成等等 什么是Editor编辑器呢?就是写代码的区域

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第9张

Editor-General

设置鼠标滚轮滚动修改字体大小

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第10张

设置成功之后,就可以通过 Ctrl+滚轮 实现代码字体大小的调节了

设置鼠标悬浮提示

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第11张

悬停提示是一个非常有用的功能,效果如下

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第12张

设置自动导包

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第13张

  • Add unambiguous imports on the fly:添加明确的导入
  • Optimize imports on the fly:自动帮我们优化导入的包

设置显示行号和方法间的分隔符

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第14张

效果如下

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第15张

忽略大小写提示

  1. Ctrl + Alt + S 打开设置界面(或者从菜单File - settings 进来)
  2. 在搜索框输入Completion定位到Code Completion功能项
  3. 在右侧配置界面选中All letters
  4. 在右侧配置界面把Match case(匹配大小写)前面的√去掉,
idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第16张

  • IntelliJ IDEA 的代码提示和补充功能有一个特性:区分大小写。如上图标注所示,默认就是 First letter 区分大小写的。
  • 区分大小写的情况是这样的:比如我们在 Java 代码文件中输入 stringBuffer, IntelliJ IDEA 默认是不会帮我们提示或是代码补充的,但是如果我们输入 StringBuffer 就可以进行代码提示和补充。

设置取消单行显示标签页(Tabs)的操作

什么是单行显示

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第17张

如何设置为多行?

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第18张

效果如下

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第19张

Editor-Font

修改当前主题代码编辑区的字体

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第20张

默认字体、字体大小、字体行间距,都可以单独设置

Editor-Color Scheme

修改当前主题控制台输出的字体

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第21张

修改代码中注释的字体颜色

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第22张

Editor-Code Style

设置超过指定 import 个数,改为\*

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第23张

Editor-File and Code Template

修改类头的文档注释信息

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第24张

效果如下

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第25张

Editor – File Encodings

设置项目文件编码

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第26张

Transparent native-to-ascii conversion 主要用于转换 ascii,一般都要勾选, 不然 Properties 文件中的注释显示的都不会是中文。

设置当前源文件的编码

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第27张

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第28张

对单独文件的编码修改还可以点击右下角的编码设置区。如果代码内容中包含中 文,则会弹出如上的操作选择。其中:

  1. Reload 表示使用新编码重新加载,新编码不会保存到文件中,重新打开此文 件,旧编码是什么依旧还是什么。
  2. Convert 表示使用新编码进行转换,新编码会保存到文件中,重新打开此文件, 新编码是什么则是什么。
  3. 含有中文的代码文件,Convert 之后可能会使中文变成乱码,所以在转换成请 做好备份,不然可能出现转换过程变成乱码,无法还原。

Build、Execution、Deployment

设置自动编译

Intellij Idea 默认状态为不自动编译状态,运行项目的时候才会进行编译,Eclipse 默认为自动编译。

不能自动编译是什么效果?图中分别是Hello.java和编译后的class文件的对比

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第29张

修改Java源代码,因为不能自动编译,所以class文件是不会有变化的

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第30张

IDEA模式是运行时编译,所以我们运行主函数,之后可以看到如下结果

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第31张

下面我们来设置自动编译,看一下效果

IDEA设置自动编译

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第32张

自动编译的效果 修改源代码

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第33张

稍等一会儿然后打开class文件可以看到如下效果

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第34张

其他

设置为省电模式

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第35张

如上图所示,IntelliJ IDEA 有一种叫做 省电模式 的状态,开启这种模式之后 IntelliJ IDEA 会关掉代码检查和代码提示等功能。所以一般也可认为这是一种阅读模式,如果你在开发过程中遇到突然代码文件不能进行检查和提示,可以来看看这里是否有开启该功能。

设置代码分屏展示

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第36张

效果如下

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第37张

还可以添加分屏快捷键

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第38张

背景图设置

  1. 在idea中 双击shift 出现搜索框 输入:Set Background Image 单击 Set Background Image
idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第39张

2.选择要添加的图片的路径,设置透明度,点击OK 就可以查看效果了

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第40张

效果如下

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第41张

IDEA 当前项目结构设置

项目结构配置就是关于当前模块的配置,只对当前模块生效,例如Jar包,包结构,源码文件夹,输出路径,依赖和项目构建信息。

如何打开 Project Structure 页面

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第42张

Project Structure 页面结构讲解

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第43张

project

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第44张

Modules

可以查看每一个子模块的信息

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第45张

Artifacts

IDEA带包配置,有时候用IDEA打的包有问题,部署到Tomcat中跑不起来,可以再打包一次。

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第46张

Facets

当前项目配置文件的相关信息

修改IDEA默认设置

idea设置教程_设置支付顺序_https://bianchenghao6.com/blog_idea_第47张

总结

以上就是我总结的IDEA开发常见的所有配置,如果本文对你有帮助,不要忘了收藏点赞支持一些。

发表回复