一、编辑器外观
-
编辑器主题
1
Setting -> Editor -> Colors & Fonts
Scheme name 选择一个喜欢的
-
编辑器字体
1
Setting -> Editor -> Colors & Fonts -> Font
先选择一个喜欢的 Scheme ,然后另存自定义的,不然字体是无法修改的。推荐Yahei Consolas Hybrid 字体
-
行号
1
Setting -> Editor -> Appearance
勾选 Show line numbers
二、窗口
-
窗口主题
1
Setting -> Appearance
选择Theme
导入主题
下载xml格式的主题文件,放入
Mac OS X
-
~/Library/Preferences/IntelliJIdea12/colors
(IntelliJ IDEA 12 Ultimate Edition) -
~/Library/Preferences/IdeaIC12/colors
(IntelliJ IDEA 12 Community Edition), -
~/Library/Preferences/WebIDE50/colors
(PHPStorm 5.0).
Windows
-
Documents and Settings/<user>/.IdeaIC12/config/colors
(IntelliJ IDEA 12 Community Edition)
-
-
窗口字体
窗口字体包括非编辑器的所有字体,默认情况下,中文会变成 口口
1
Setting -> Appearance
勾选 Override default fonts by(not recommended) 在下面的字体中选择一个中文字体(默认情况应该是口口,先随便选一个)
三、快捷键
-
编辑类
从历史记录中粘贴 paste from history ——–
Ctrl+Shift+v
选择光标处的单词 select word at caret ——–Ctrl+w
查找 find ——–Ctrl+f
在路径中查找,可以在整个项目中查找 find in path ——–Ctrl+Shift+f
替换 replace ——–Ctrl+r
在路径中替换,可以在整个项目中替换 replace in path ——–Ctrl+Shift+r
合并行 join lines ——–Ctrl+Shift+j
删除当前行 ——–Ctrl+y
复制当前行 ——–Ctrl+v
剪切当前行 ——–Ctrl+x
复制当前行到下一行 ——–Ctrl+d
切换光标所在单词的大小写Toggle Case
——–Ctrl+Shift+U
查找所有引用 find usage ——–Alt+F7
-
查看
显示 project ——–Alt+1
当前类的结构窗口 ——–Alt+7
显示类的层级关系窗口 ——–Alt+8
显示定义 Quick Definition ——–Ctrl+Shift+i
显示文档 Quick Documentation ——–Ctrl+q
参数信息 Parameter info ——–Ctrl+p
上下文信息 Context info ——–Alt+q
跳到源代码 Jump to Source ——–F4
-
定位
定位 Class ——–Ctrl+n
定位 File ——–Ctrl+Shift+n
跳转到 n 行 ——–Ctrl+g
跳转到光标前一次所在的位置 ——–Ctrl+Shift+左箭头
跳转到光标后一次所在的位置 ——–Ctrl+Shift+右箭头
跳转到上一次编辑所在的位置 ——–Ctrl+Shift+右箭头
跳转到导航栏 ——–Ctrl+Shift+右箭头
跳转到声明处 ——–Ctrl+b
跳转到所在类的声明位置 ——–Ctrl+Shift+b
跳转到所对应的Test类 ——–Ctrl+Shift+t
跳转到相关的文件 ——–Ctrl+Alt+Home
显示文件结构 FileStructure ——–Ctrl+F12
显示文件路径 File Path ——–Ctrl+Alt+F12
类层级结构 Type Hierarchy ——–Ctrl+h
方法层级结构 Method Hierarchy ——–Ctrl+Shift+h
调用层级结构 call Hierarchy ——–Ctrl+Alt+h
下一个高亮错误 Next HigtLighted Error ——–F2
上一个高亮错误 Previous HigtLighted Error ——–Shift+F2
上一个调用 Go to Previous call * ——–Ctrl+Alt+上箭头
下一个调用 Go to Next call * ——–Ctrl+Alt+下箭头
下一个方法 Next Method ——–Alt+下箭头
上一个方法 Previous Method ——–Alt+上箭头
-
代码
重写方法 Override Methods ——–Ctrl+o
实现方法 Implement Methods ——–Ctrl+i
生成 generate ——–Alt+insert (构造函数,get,set,重写...)
代码包裹 Surround With ——–Ctrl+Alt+t (if,while,for,try-catch,....)
行注释 Comment with line comment ——–Ctrl+/
块注释 Comment with block comment ——–Ctrl+Shift+/
优化导入 optimize ——-Ctrl+Alt+o
格式化代码 Reformat code ——–Ctrl+Alt+l
自动缩进 Auto-indent Lines ——–Ctrl+Alt+i
将该行向下移动 Move line Down ——–Alt+Shift+下箭头
将该行向上移动 Move line up ——–Alt+Shift+上箭头
-
其他
重命名文件,类名,参数名,方法名 ——–Shift+F6
设置菜单 ——–Ctrl+Alt+s
项目菜单 ——–选中项目后+F4
-
编译
在 Idea 里面自动保存,注意跟 Eclipse 里面区别,Idea 里面不会自动编译,在 Idea 里面有三个选项: - Compile ——–
Ctrl+Shift+F9
:只编译选定的目标,不管之前是否已经编译过。 - Make ——–
Ctrl+F9
:编译选定的目标,但是Make只编译上次编译变化过的文件,减少重复劳动,节省时间。(速度快) - Build:是对整个工程进行彻底的重新编译,而不管是否已经编译过。Build过程往往会生成发布包,这个具体要看对IDE的配置了,Build在实际中应用很少,因为开发时候基本上不用,发布生产时候一般都用ANT等工具来发布。Build因为要全部编译,还要执行打包等额外工作,因此时间较长。
-
四、idea 中的其他问题
- 在 idea中 project 相当于 eclipse 中的 workspace
module 相当于 eclipse 中的 project
- 在 idea中 project 相当于 eclipse 中的 workspace