一、常用的快捷鍵
- 代碼補(bǔ)全Ctrl + space
- 刪除當(dāng)前行Command + X
- 復(fù)制粘貼當(dāng)前行 Command + D
- 注釋 Command + /
- 導(dǎo)入包Command + shift + O
- 格式化代碼Command + shift + F
- 運(yùn)行Ctrl + Alt + R
- Incremental SearchCommand + J 在編輯器中實(shí)現(xiàn)快速查找功能,通過上下箭頭進(jìn)行上下文搜索
- Quick Definition Command + Y 它會(huì)彈窗顯示建議列表中的方法定義的內(nèi)容,如果你不確定要使用哪個(gè)方法
- Find NextCommand + K
- Find PreviousCommand + shift + K
- 詳細(xì)方法、類Ctrl + 點(diǎn)擊類名、方法
- Ctrl+Alt+ left/right 返回至上次瀏覽的位置
- Command + F12 類似eclipse 的ctrl + O的功能outline
二、 調(diào)整界面為酷酷的黑色
Preferences -> Appearance -> theme -> Dracula
三、 設(shè)置快捷鍵:
Preferences -> keycaps
四、 自動(dòng)補(bǔ)全:
Mac下默認(rèn)是clt+space,可以使用keymaps=>Main menu=>Code=>Competion設(shè)置。比Eclipse好的地方是Spring、Maven的xml,乃至freemarker模板以及iBatis的sqlmap都支持高亮和自動(dòng)補(bǔ)全。
五、 去除自動(dòng)補(bǔ)全的大小寫敏感:
不知道多少童鞋和我一樣被Eclipse慣壞了,使用自動(dòng)補(bǔ)全完全不注意大小寫的,IntelliJ默認(rèn)區(qū)分大小寫,很是讓人難過。不過在Editor=>Code Completion里把Case sensitive completion設(shè)置為None就可以了。
六、自動(dòng)展開目錄
Eclipse有個(gè)打開文件就自動(dòng)展開目錄的功能,在IntelliJ里從Project左邊欄的齒輪上選擇Autoscroll to Source和Autoscroll from Source都勾選上即可。
七、自動(dòng)編譯
IntelliJ默認(rèn)是不會(huì)自動(dòng)編譯項(xiàng)目的,所以在run之前會(huì)有個(gè)make的過程,習(xí)慣自動(dòng)編譯項(xiàng)目的可以在這里打開:Compiler=>make project automatically。因?yàn)镮ntelliJ項(xiàng)目空間不大,所以開啟之后也不會(huì)像Eclipse一樣出現(xiàn)build workspace很久的情況。
Eclipse 和 intellij的快捷鍵對照表
| Eclipse | IntelliJ IDEA | Description |
|---|---|---|
| F4 | ctrl+h | show the type hierarchy |
| ctrl+alt+g | ctrl+alt+F7 | find usages |
| ctrl+shift+u | ctrl+f7 | finds the usages in the same file |
| alt+shift+r | shift+F6 | rename |
| ctrl+shift+r | ctrl+shift+N | find file / open resource |
| ctrl+shift+x, j | ctrl+shift+F10 | run (java program) |
| ctrl+shift+o | ctrl+alt+o | organize imports |
| ctrl+o | ctrl+F12 | show current file structure / outline |
| ctrl+shift+m | ctrl+alt+V | create local variable refactoring |
| syso ctrl+space | sout ctrj+j | System.out.println(“”) |
| alt + up/down | ctrl + shift + up/down | move lines |
| ctrl + d | ctrl + y | delete current line |
| ??? | alt + h | show subversion history |
| ctrl + h | ctrl + shift + f | search (find in path) |
| “semi” set in window-> preferences | ctrl + shift + enter if I want to | add the semi-colon at the end of a statement |
| ctrl + 1 or ctrl + shift + l | ctrl + alt + v | introduce local variable |
| alt + shift + s | alt + insert | generate getters / setters |
| ctrl + shift + f | ctrl + alt + l | format code |
| ctrl + y | ctrl + shift + z | redo |
| ctrl + shift + c | ctrl + / | comment out lines (my own IDEA shortcut definition for comment/uncomment on german keyboard layout on laptop: ctrl + shift + y) |
| ctrl + alt + h | ctrl + alt + h (same!) | show call hierarchy |
| none ? | ctrl + alt + f7 | to jump to one of the callers of a method |
| ctrl + shift + i | alt + f8 | evaluate expression (in debugger) |
| F3 | ctrl + b | go to declaration (e.g. go to method) |
| ctrl + l | ctrl + g | go to line |
參考:http://www.catalysts.cc/en/wissenswertes/intellij-idea-and-eclipse-shortcuts/