快捷键配置 eclipse复制:
keymap-eclipse copy
配置常用快捷键
keymap:搜索
- rename 改为 F2
- show in explore 改为 F3
- implementation 改为 ctrl+鼠标右键
- 代码提示 basic改为 alt+/
- 搜万物 double shift
- 显示方法入参 parameter info | ctrl +p
- debug显示变量的值 ctrl+u(同eclipse的ctrl+shift+i)
- debug直接跳转到光标所在行 ctrl+r
- 实现接口(implement methods) alt+shift+p
- 新建测试类 光标置于类名处| 右键 | Go To | Test | Create New Test…
- 格式化代码reformat code:ctrl+shift+f
- 重构代码 alt+shit+m
- 搜索代码 ctrl+h
- 方法引用 ctrl+alt+h
- 搜索文件 ctrl+shift+r,可使用文件名:行数
- pull当前项目 ctrl+shift+L
基本配置
- 折叠中间层的package 左上角project旁的齿轮 | 勾选 Compact Middle Packages
- 配置gitignore File | Settings | Editor | File Types 新增
*.idea;*.iml;
- 字体大小 font16,console font14
- 联想首字母忽略大小写 File | Settings | Editor | General | Code Completion | 不勾选match case
- 类名处可自动生成序列化ID File | Settings | Editor | Inspections | Java | Serialization issues | 勾选 Serializable class without ‘serialVersionUID’
- 文件多行显示:File | Settings | Editor | General | Editor Tabs | 不勾选show tabs in one row
- 文件显示在project右侧:File | Settings | Editor | General | Editor Tabs | Tab placement 选择 left
- 悬浮显示文档:File | Settings | Editor | General | 勾选show quick documentation on mouse move, delay 1000
- 黑色界面导致鼠标看不到:个性化 | 更改鼠标指针 | 文本选择 | beam_r.cur
- 显示使用内存 File | Settings | Appearance & Behavior | Appearance | show memory indicator
- 全局内容搜索和替换:Edit | Find | Replace in path
- 调整代码检查级别 IDEA界面右下角 | Highlighting Level
- 自动编译 File | Settings | Build, Execution, Deployment | Compiler | build project automatically
- 配置格式化文件:File | Settings | Editor | Code Style | 导入schema
- 配置consle打印数据量: File | Settings | Editor | General | Console | Override console cycle buffer size (1024KB) | 复写对应数量
- 打开新项目时询问 File | Settings | Appearance & Behavior | System Settings | project opening | comfirm window to open project in
- 启动时选择项目进入 File | Settings | Appearance & Behavior | System Settings | 取消reopen last project on startup勾选
- 导入user library : project structure | library | 点中间加号 | 添加jar包上一级的文件夹
- 导出导入配置文件settings:file-import settings/export settings
- custom tags:File | Settings | Editor | Inspections | Java | Javadoc | declaration has Javadoc problems
- 解决IDEA自动生成返回值带有final修饰词
1、Settings | Editor | Code Style | Java | Code Generation | Final Modifier下2个单选框都不勾选
2、.var自动生成后,取消勾选 Declare final,即可
- 关于apiDoc使用的注解IDEA报黄Wrong tag
可直接在对应注解上Alt+Enter,将其添加到custom tags
查看对应custom tags位置:Settings | Inspections | Javadoc | Declaration has Javadoc problems | Options | Additional Javadoc tags:
- 配置encoding
File | Settings | Editor | File Encodings
- Global Encoding 改为 UTF-8
- Project Encoding 改为 UTF-8
- Default encoding for properties files 改为 UTF-8
- 打勾 Transparent native-to-ascii conversion
- 自动优化 import 包:File | Settings | Editor | General | Auto Import,所有的框都打钩
- 设置导包不带*
- File | Settings | Editor | Code Style | Java | imports
- 设置 Class count to use import with ‘*’ 值为500
- 设置 Names count to use static import with ‘*’ 值为300
- pom文件修改,手动添加jar:
File | Settings | Build, Execution, Deployment | Build Tools | Maven | Importing | 取消勾选import maven projects automatically
- 配置jdk
- project structure | project/sdks;
- File | Settings | Build, Execution, Deployment | Build Tools | Maven | Importing;
- File | Settings | Build, Execution, Deployment | Compiler | Java Compiler;
- project structure | modules-sources/dependencies
- 自动显示文件位置:左侧齿轮,勾选autoscroll to source,autoscroll from source
- 窗口复原 restore layout
- 聚焦代码窗口:齿轮 | view mode | dock unpinned
- JavaDoc格式化,保留换行
- File | Settings | Editor | Code Style | Java | JavaDoc 勾选
- 1、Enable JavaDoc formatting
- 2、Wrap at right margin
- 3、Preserve line feeds
- idea缺少iml文件::maven 窗口 | Generate Sources and Update Folders For All Projects
- 重新导入jar包:maven 窗口 | 点击 reimport all maven project
常用模板
- main方法生成 psvm,
- 控制台打印 sout,
- for循环 iter,fori
- 定义变量 *.var
- 新建实时模板:settings - editor - live templates
ctrl+alt+shift+/,选择选项Registry
- 勾选compiler.automake.allow.when.app.running(ctrl+F9)
- 增大撤销步数:undo.documentundolimit500
- 在文档窗口中显示导航工具栏:documentation.show.toolbar
变化的文件询问是否加入版本管理
File | Settings | Version Control | Confirmation
- 勾选 show options before adding to version control
- 勾选 show options before removing from version control
- 勾选 show options before removing
- 其它默认勾选
配置version control :
- File | Settings | Version Control | Git
- File | Settings | Version Control | Subversion
集成svn:
- 安装svn时要安装command line client tools(svn.exe)
- idea配置后:VCS | enable version control integration | 选择subversion
- 打开 version control 窗口: View | Tool Windows | version control
- svn回到某个版本:先svn show log再revert to this reversion
- 设置活动变更列表:version control | 选中分组 | set active changelist
- 提交版本库:iml,project,classpath不提交
集成git
- idea配置后:VCS | enable version control integration | 选择git
- 官网下载速度超级慢:https://gitforwindows.org/
- 可参考:镜像网站
git remote update origin --prune
git刷新远程分支,然后在项目pull下代码
修改代码配色方案:
- File | Settings | Editor | Color Scheme | Java | darcula copy | 取消勾选inherit values form | 再在Foreground选配色
- IDEA自带rgb取色功能,可参考配色如下
- methods-method call 蓝色 80.180.240
- parameters-parameter 紫色 200.180.255
- classes and interface-class 橘红色 225.110.120 已弃用
- 深紫色 200.120.220
- 资料参考
介绍一种养眼的IDEA/Pycharm/Clion配色方案
选中代码高亮:
- File | Settings | Editor | Color Scheme | General |
- identifier under caret:background 草绿色 200.255.200,error stripe mark 绿色 5.255.46
- identifier under caret(srite): background 黄色 255.248.0, error stripe mark 黄色 255.248.0
idea设置类头注释
File | Settings | Editor | File and Code Templates | Includes | +号 | 命名File Header | 写内容
idea非maven项目报错解决依赖问题:
modules-选中报错module,选择dependencies,添加对应的jar包或文件夹或module
maven项目的文件夹标识mark dictionary as sources root
as excluded (不会编译进去)
使用64位的配置启动对应的配置文件:idea64.exe.vmoptions
解决生成的png图片乱码,但会导致log4j中文乱码,idea乱码
- 文件的编码格式,运行配置的idea64.exe.vmoptions
- -Dfile.encoding=UTF-8
idea首次加载慢:加索引,缓存,C:\Users\abc\.IntelliJIdea2019.2
- 断电之后,可使用invalidate cache/restart
- 可将system和config文件夹换位置,在idea.properties,固态硬盘可不换,因io速度更快
端口冲突
netstat -ano | findstr 8080
找到第一行最后末尾的pid
taskkill /f /pid 62804
IntelliJ IDEA 项目结构旁边出现 0%classes,0% lines covered
- ctrl+alt+F6,取消勾选–>点击Show Selected