Java学习者论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

手机号码,快捷登录

恭喜Java学习者论坛(https://www.javaxxz.com)已经为数万Java学习者服务超过8年了!积累会员资料超过10000G+
成为本站VIP会员,下载本站10000G+会员资源,购买链接:点击进入购买VIP会员
JAVA高级面试进阶视频教程Java架构师系统进阶VIP课程

分布式高可用全栈开发微服务教程

Go语言视频零基础入门到精通

Java架构师3期(课件+源码)

Java开发全终端实战租房项目视频教程

SpringBoot2.X入门到高级使用教程

大数据培训第六期全套视频教程

深度学习(CNN RNN GAN)算法原理

Java亿级流量电商系统视频教程

互联网架构师视频教程

年薪50万Spark2.0从入门到精通

年薪50万!人工智能学习路线教程

年薪50万!大数据从入门到精通学习路线年薪50万!机器学习入门到精通视频教程
仿小米商城类app和小程序视频教程深度学习数据分析基础到实战最新黑马javaEE2.1就业课程从 0到JVM实战高手教程 MySQL入门到精通教程
查看: 416|回复: 0

[默认分类] IntelliJ IDEA常用设置

[复制链接]
  • TA的每日心情
    开心
    2021-12-13 21:45
  • 签到天数: 15 天

    [LV.4]偶尔看看III

    发表于 2018-5-30 12:43:05 | 显示全部楼层 |阅读模式





    IntelliJ IDEA是一款非常优秀的java编辑器,初学都可会对其中的一些做法感到很别扭,刚开始用的时候我也感到很不习惯,在参考了网上一些文章后在这里把我的一些经验写出来,希望初学者能快速适应它,不久你就会感觉到编程是一种享受了。



    安装后的一些设置技巧:

    1.

    如何完美显示中文:Settings->Appearance中勾选Override default fonts by (not recommended),设置Name:NSimSun,Size:12


    screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor="hand"; this.alt="Click here to open new window\nCTRL+Mouse wheel to zoom in/out";}" onclick="if(!this.resized) {return true;} else {window.open("http://www.itdaan.com/imgs/5/7/2/6/13/d6478db99bf3f64e79827fd4b013a89a.jpe");}" alt="" src="http://www.itdaan.com/imgs/5/7/2/6/13/d6478db99bf3f64e79827fd4b013a89a.jpe" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt="Click here to open new window\nCTRL+Mouse wheel to zoom in/out";}" border="0">

    2.

    如何让光标不随意定位:Settings->Editor中去掉Allow placement of caret after end of line。


    screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor="hand"; this.alt="Click here to open new window\nCTRL+Mouse wheel to zoom in/out";}" onclick="if(!this.resized) {return true;} else {window.open("http://www.itdaan.com/imgs/7/8/2/0/43/1992019bfd6a34f14e80fd0b592da5fb.jpe");}" alt="" src="http://www.itdaan.com/imgs/7/8/2/0/43/1992019bfd6a34f14e80fd0b592da5fb.jpe" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt="Click here to open new window\nCTRL+Mouse wheel to zoom in/out";}" border="0">

    3.

    如何显示行号:Settings->Editor->Appearance标签项,勾选Show line numbers


    screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor="hand"; this.alt="Click here to open new window\nCTRL+Mouse wheel to zoom in/out";}" onclick="if(!this.resized) {return true;} else {window.open("http://www.itdaan.com/imgs/0/3/4/2/13/a8d7e21202d51613e2bc9bc72be85e6b.jpe");}" alt="" src="http://www.itdaan.com/imgs/0/3/4/2/13/a8d7e21202d51613e2bc9bc72be85e6b.jpe" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt="Click here to open new window\nCTRL+Mouse wheel to zoom in/out";}" border="0">

    4.

    如何让IntelliJ IDEA动的时候不打开工程文件:Settings->General去掉Reopen last project on startup.


    screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor="hand"; this.alt="Click here to open new window\nCTRL+Mouse wheel to zoom in/out";}" onclick="if(!this.resized) {return true;} else {window.open("http://www.itdaan.com/imgs/2/3/4/1/87/b43fa510b7e72a932794069b8ebd2ac8.jpe");}" alt="" src="http://www.itdaan.com/imgs/2/3/4/1/87/b43fa510b7e72a932794069b8ebd2ac8.jpe" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt="Click here to open new window\nCTRL+Mouse wheel to zoom in/out";}" border="0">

    5.

    在IntelliJ IDEA中为什么无法起动Tomcat:请使用ZIP版的Tomcat

    6.

    默认代码提示和补全快捷键跟输入法冲突,如何解决:Settings->Keymap


    screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor="hand"; this.alt="Click here to open new window\nCTRL+Mouse wheel to zoom in/out";}" onclick="if(!this.resized) {return true;} else {window.open("http://www.itdaan.com/imgs/7/3/8/1/48/0f76daa80f0f44db7df1579e82d386b0.jpe");}" alt="" src="http://www.itdaan.com/imgs/7/3/8/1/48/0f76daa80f0f44db7df1579e82d386b0.jpe" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt="Click here to open new window\nCTRL+Mouse wheel to zoom in/out";}" border="0">

    先copy一份快捷键方案。


    screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor="hand"; this.alt="Click here to open new window\nCTRL+Mouse wheel to zoom in/out";}" onclick="if(!this.resized) {return true;} else {window.open("http://www.itdaan.com/imgs/9/7/0/0/33/76af9b1206b5bbb79a46e7a1ae6a70fe.jpe");}" alt="" src="http://www.itdaan.com/imgs/9/7/0/0/33/76af9b1206b5bbb79a46e7a1ae6a70fe.jpe" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt="Click here to open new window\nCTRL+Mouse wheel to zoom in/out";}" border="0">

    再展开。如图:


    screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor="hand"; this.alt="Click here to open new window\nCTRL+Mouse wheel to zoom in/out";}" onclick="if(!this.resized) {return true;} else {window.open("http://www.itdaan.com/imgs/1/8/8/8/60/27151f7550f2ff9d27319b1439451a51.jpe");}" alt="" src="http://www.itdaan.com/imgs/1/8/8/8/60/27151f7550f2ff9d27319b1439451a51.jpe" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt="Click here to open new window\nCTRL+Mouse wheel to zoom in/out";}" border="0">

    选择功能,再添加一个新的快捷键


    screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor="hand"; this.alt="Click here to open new window\nCTRL+Mouse wheel to zoom in/out";}" onclick="if(!this.resized) {return true;} else {window.open("http://www.itdaan.com/imgs/2/8/3/8/95/a09062a6c682bbe067b3f32b69528936.jpe");}" alt="" src="http://www.itdaan.com/imgs/2/8/3/8/95/a09062a6c682bbe067b3f32b69528936.jpe" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt="Click here to open new window\nCTRL+Mouse wheel to zoom in/out";}" border="0">

    剩下功能,也要改,如上图蓝色字体部分。我只是把原有快捷键中的空格改成了“;”,就是分号,这样会方便很多。








    IntelliJ IDEA 5.0 快捷键

    来源:
    acumen 1. Ctrl + Space     完成类、方法、变量名称的自动输入

    这个快捷键是我最经常使用的快捷键了,它可以完成类、方法、变量名称的自动录入,很方便,现在我写程序基本上都不会完整的输入变量名称了,因为有了工具帮你输入,为什么还要自己敲键盘呢?



    2. Ctrl + N(Ctrl + Shift + N)     跳转到指定的java文件(其它文件)

    这个功能很方便,至少我不用每回都在一长串的文件列表里找寻我想要编辑的类文件和jsp文件了

    3. Ctrl + B     跳转到定义处

    4. Ctrl + Alt + Right/Left     在编辑过的代码位置之间跳转(前进/后退)

    5. Ctrl + Alt + T        用*来围绕选中的代码行( * 包括if、while、

                              try catch等)

    这个功能也很方便,把以前要做的:①先写if-else,②然后调整代码的

    缩进格式,还要注意括号是否匹配了,现在用这个功能来做,省事多了

    6. Ctrl + Alt + B       跳转到方法实现处

    7. Ctrl + W       按一个word来进行选择操作

    在IDEA里的这个快捷键功能是先选择光标所在字符处的单词,然后是选择源

    代码的扩展区域。举例来说,对下边这个语句

    java.text.SimpleDateFormat formatter =

    new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm");

    当光标的位置在双引号内的字符串中时,会先选中这个字符串,然后是等号

    右边的表达式,再是整个句子。我一般都是在对代码进行重新修改的时候使用

    它来选择出那些长长的复合表达式,很方便:)

    8. Shift + F1       在浏览器中显示指定的java docs

    这个也应该是几乎所有的java ide都提供的功能,就不多说了。

    9. Ctrl + Q         在editor window中显示java docs

    这个功能很方便--因为有时仅仅是忘记了自己编写的方法中的某个参数的

    含义,此时又不想再起一个浏览器来查看java doc,此时这个功能的好处就

    体现出来了

    10. Ctrl + /        注释/反注释指定的语句

    它可以注释和反注释你所选择的语句(使用单行注释符号"//"),

    也可以用Ctrl + Shift + / 来进行多行语句的注释(即使用多行注释符号"/* ... */")

    11. F2/Shift + F2              跳转到下/上一个错误语句处

    IDEA提供了一个在错误语句之间方便的跳转的功能,你使用这个快捷键可以

    快捷在出错的语句之间进行跳转。

    12. Shift + F6                 提供对方法、变量的重命名

    对IDEA提供的Refector功能我用得比较少,相比之下这个功能是我用得最多

    的了。对于这个功能没什么可说的了,确实很方便,赶快试一试吧。



    13. Ctrl + Alt + L         根据模板格式化选择的代码

    根据模板中设定的格式来format你的java代码,不过可惜的是只对java文件

    有效:(

    14. Ctrl + Alt + I         将选中的代码进行自动缩进编排

    这个功能在编辑jsp文件的时候也可以工作,提供了一个对上边格式化代码

    功能的补充。

    15. Ctrl + Alt + O         优化import

    自动去除无用的import语句,蛮不错的一个功能。

    16. Ctrl + ]/[             跳转到代码块结束/开始处



    Ctrl+G(跳转到指定行)、Ctrl+F4(关闭当前编辑页面)、Ctrl+F(搜索)等等

    可以去IDEA的官方网站下载一份IDEA 3.0 Default Keymap的pdf文档


    http://www.intellij.com/docs/ReferenceCard.pdf),上面有快捷键的

    详细列表及功能简介,如果你觉得IDEA定义的快捷键的键位组合不符合你的

    使用习惯的话,你可以在Option--Keymaps中修改设置成你的习惯键位组合。





    Ctrl+Space            // Complete Code, 与输入法冲突, 改为Alt+S

    Ctrl+D                // 行复制, 或选定字符串复制

    Ctrl + W       按一个word来进行选择操作

    Ctrl + N(Ctrl + Shift + N)     //跳转到指定的java文件(其它文件)

    Ctrl + B     跳转到定义处

    Ctrl + Alt + B       跳转到方法实现处

    Ctrl+J                // 插入代码模板

    Alt+Insert            // Generate, 生成Constructor, setter, getter

    Ctrl+O                // 覆盖方法

    Ctrl+I                // 实现方法

    Ctrl+Alt+T            // Surround With

    Ctrl+/                // 行注释

    Ctrl + Shift + / 来进行多行语句的注释(即使用多行注释符号"/* ... */")

    Ctrl + Alt + L            // 格式化代码

    Ctrl + Alt + O         优化import

    Ctrl + Alt + T        用*来围绕选中的代码行( * 包括if、while、

                              try catch等)

    Alt+F7                // 查找使用情况

    Shift+F6              // 重命名

    F6                    // 移动

    Ctrl+Shift+F7         // 显示字符串使用次数

    Alt+Delete            // 安全删除

    Ctrl + ]/[             跳转到代码块结束/开始处
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|手机版|Java学习者论坛 ( 声明:本站资料整理自互联网,用于Java学习者交流学习使用,对资料版权不负任何法律责任,若有侵权请及时联系客服屏蔽删除 )

    GMT+8, 2024-5-17 13:20 , Processed in 0.360283 second(s), 46 queries .

    Powered by Discuz! X3.4

    © 2001-2017 Comsenz Inc.

    快速回复 返回顶部 返回列表