Intellij idea快捷键与设置(Mac)

1. 代码提示大小写不敏感
Preferences -- Editor -- General -- Code Completion -- 取消勾选"Math case"



2. 清除过往项目缓存
当创建项目时,如果存在以往创建过的同名项目,将会提示下面的错误:
Failed to create a Maven project: ‘xxx/pom.xml‘ already exists in VFS
解决此问题的步骤是:
File -- Invalidate Caches/Restart -- 执行Invalidate and Restart


3. 新增Spring context xml模板
通过下面的步骤进入设置界面
File -- Other Settings -- Preferences for New Projects -- Editor -- File and Code Templates
添加一个"Spring Context XML",后缀为"xml"的模板,内容如下:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
                           http://www.springframework.org/schema/beans/spring-beans.xsd
                           http://www.springframework.org/schema/context
                           http://www.springframework.org/schema/context/spring-context.xsd
                           http://www.springframework.org/schema/aop
                           http://www.springframework.org/schema/aop/spring-aop.xsd
                           http://www.springframework.org/schema/tx
                           http://www.springframework.org/schema/tx/spring-tx.xsd
                           http://www.springframework.org/schema/mvc
                           http://www.springframework.org/schema/mvc/spring-mvc.xsd">

    <!-- regular spring configuration file defining the beans for this
       bundle. The configuration of OSGi definitions is kept in a separate 
       configuration file so that this file can easily be used
       for integration testing outside of an OSGi environment -->
</beans>

最后勾选"Enable Live Templates"来启用模板。



4. Tab键跳出引号和括号
Intellij IDEA -- Preferences -- Editor -- General -- Smart Keys -- 勾选"Jump outside closing bracket/quote with Tab"


5. 自动清除多余的引用(import)
control + option + 字母O


6. 修改代码行距
Intellij IDEA -- Preferences -- Editor -- Font -- Line Spacing


7. 取消单行代码自动折叠
Intellij IDEA -- Preferences -- Editor -- General -- Code Folding -- 取消勾选"One-line methods"


8. 关闭拼写检查器
当拼写检查器发现疑似拼写错误时,会用绿色下划波浪线提示我们,要关闭此功能,执行:
Intellij IDEA -- Preferences -- Editor -- Inspections -- Spelling -- Typo,将选项卡下的几个复选框取消勾选。


9. 生成getter和setter
在编辑区域鼠标右键,选择"generate..."--"Getter and Setter",从弹出窗口里选择要生成Getter和Setter的属性。
快捷键是command + N


10. 整行移动
option + shift + 上/下


11. 选中光标左右的行内容
command + shift + 左/右


12. (光标所在)整行删除
command + delete


13. 强制类型转换
option + Enter


14. 复制(悬浮)提示框里的内容
选中提示框里的文本内容,然后按住option + Q,再点左键


15. 显示/隐藏左右边栏
点击最左下角的小图标


16. 已知类名,生成import
点击类名,然后option + Enter


17. 新起一行,并移动光标到行首
向上:option + command + Enter
向下:shift + Enter


18. 大小写转换
command + shift + u


19. pom.xml智能提示失效的修复
一般出现这种情况,需要进入Maven--Repositories里,Update一下仓库

猜你喜欢

转载自www.cnblogs.com/CoderWayne/p/12394616.html