1逢唤、常用設(shè)置
(1)編輯區(qū)字體大小隨鼠標(biāo)滾動(dòng)大小設(shè)置
preference -> editor -> gerneral 勾選
(2)鼠標(biāo)懸浮提示
preference -> editor -> gerneral 勾選
(3)自動(dòng)導(dǎo)包和優(yōu)化多余包
preference -> editor -> gerneral -> auto import 勾選
(4)同一個(gè)包下類,超過多少后import合成星號(hào)
preference -> editor -> codestyle -> java -> imports
(5)展示行號(hào)以及方法間的分隔符
preference -> editor -> gerneral -> appearance 勾選
(6)代碼提示時(shí)忽略大小寫匹配
preference -> editor -> gerneral -> code completion 去掉勾選
(7)多個(gè)文件打開時(shí)能夠展示更多文件tab,并且文件tab可以分行展示
preference -> editor -> gerneral -> editor tabs
(8)修改類頭文檔注釋信息
preference -> editor -> file and code templates
(9)設(shè)置項(xiàng)目編碼
preference -> editor -> file encodings
(10)自動(dòng)編譯
preference -> build,execution,deployment -> compiler 勾選
(11)省電模式,不能默認(rèn)勾選,否則影響一些自動(dòng)編譯
(12)生成序列號(hào)版本號(hào)
preference -> editor -> inspections 勾選
2、常用快捷鍵
第一個(gè)為windows環(huán)境快捷鍵九巡,第二個(gè)為mac環(huán)境快捷鍵
創(chuàng)建內(nèi)容:alt + insert | command + n
復(fù)制一行:ctrl + d | commad + d
刪除一行:ctrl + y | command + delete
代碼上移:ctrl + shift + up | command + shift + up
代碼下移:ctrl + shift + down | command + shift + down
上下選擇:alt + up/down | option + up/down
撤銷:ctrl + z | command + z
反向撤銷:ctrl + shift + z | command + shift + z
搜索類:ctrl + n | command + o
代碼生成(構(gòu)造器、getter setter等):alt + insert | command + n
意向動(dòng)作:alt + enter | option + enter
單行注釋:ctrl + / | command + /
多行注釋:ctrl + shift + / | control + shift + /
生成代碼塊包圍:ctrl + alt + t | command + option + t
代碼自動(dòng)提示蹂季,自動(dòng)補(bǔ)齊:需要修改熱鍵冕广,preference->key map->completion basic 修改成alt + / | option + /
進(jìn)入類:ctrl + 鼠標(biāo)點(diǎn)擊 | command + 鼠標(biāo)點(diǎn)擊
看具體實(shí)現(xiàn)類:ctrl + alt + 鼠標(biāo)點(diǎn)擊 | command + option + 鼠標(biāo)點(diǎn)
前進(jìn):ctrl + alt + 右箭頭 | command + opiton + 右箭頭
后退:ctrl + alt + 左箭頭 | command + option + 左箭頭
手動(dòng)導(dǎo)包:ctrl + alt + o | command + option + o
自動(dòng)縮進(jìn):control + option + i
格式化:ctrl + alt + l | control + option + l
自動(dòng)結(jié)束:ctrl + shift + enter | command + shift + enter
方法覆蓋,生成實(shí)現(xiàn)方法:ctrl + o 偿洁,ctrl + i | control + o 撒汉,control + i
顯示方法調(diào)用樹:ctrl + h,ctrl + alt + h | control + h涕滋,control + option + h
3睬辐、postfix completion 和 live templates
postfix completion 在 preference -> editor -> gerneral -> postfix completion中設(shè)置
live templates 在 preference -> editor -> live templates中設(shè)置
常見的(輸完后tab自動(dòng)生成):
main函數(shù)生成:main 或 psvm
system.out.println輸出:sout 或者 xxx.sout
for循環(huán):fori 或 xxx.fori xxx.forr(逆向)
增強(qiáng)for:iter 或 xxx.for
null 判斷:ifn 或 xxx.null
// ifn +tab
if( xxx == null ){
}
非null判斷:inn 或 xxx.nn
private static final : prsf
public static final :psf
4、導(dǎo)入maven工程
idea中的project 相當(dāng)于eclipse中的工作空間宾肺,modules相當(dāng)與eclipse中的project溉委。
首次導(dǎo)入maven項(xiàng)目后,需要在pom.xml上右擊然后reimport 加載jar的依賴爱榕。