idea 配置和常用快捷鍵

idea配置

1. 設(shè)置SDK及SDK編譯版本、字體、編碼

file -> Project Structure -> ProjectSdk

file -> settings -> 搜索font、encoding,分別設(shè)置字體、編碼

搜索功能真好用...

  • 類似的,設(shè)置注釋模板時(shí),搜索"template" 就能找到相應(yīng)界面設(shè)置
2. 配置maven

file -> settings 搜索框搜索maven ,將maven的Maven home directory設(shè)置成自己的;

default settings: idea全局配置(或 新點(diǎn)的版本沒(méi)有default settings 變成settings for new project) 全局配置;
settings:當(dāng)前項(xiàng)目配置

3. 設(shè)置代碼編譯java版本

file -> other setting -> settings for new project 搜索Java compl,將project bytecode version 設(shè)置為8,全局配置編譯版本為1.8

file -> project structure -> 將本次打開(kāi)的項(xiàng)目編譯版本設(shè)置為1.8

修改pom,添加插件指定maven 編譯版本:

官方文檔:http://maven.apache.org/components/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-complier-plugin</artifactId>
    <configuration>
        <source>1.8</source>
        <target>1.8</target>
        <encoding>UTF-8</encoding>
    </configuration>
</plugin>
4. 配置git

file -> settings -> 搜索git -> 設(shè)置git.exe目錄

5. 修改配置文件、緩存文件的位置

idea對(duì)項(xiàng)目文件做了索引,以加快查找速度。創(chuàng)建索引、加載緩存等都需要消耗時(shí)間。

索引、緩存文件默認(rèn)保存在C盤(pán) userhome下

idea.system.path=${user.home}/.IntelliJIdea/system

隨著使用idea頻率的增高,system文件會(huì)變大。如果C盤(pán)空間不足,可以修改到其他盤(pán)

IntelliJ IDEA 2018.3.1\bin\idea.properties

  • idea.system.path
  • idea.config.path

補(bǔ)充一點(diǎn),idea64.exe.vmoptions/idea32.exe/vmoptions分別是64/32位idea的配置文件。在這里配置的是虛擬機(jī)參數(shù)等。例如,加用戶名

-Duser.name=xxx

6. 亂碼
  • 亂碼的文件中右鍵 -> file encoding -> UTF-8

  • 設(shè)置項(xiàng)目編碼:file -> settings -> file encodings -> global encoding -> utf-8

  • 設(shè)置全局編碼:file -> other settings -> default/settings for new project -> file encodings -> 搜索"file encodings" -> global encoding -> utf-8

  • 實(shí)在不行:到IntelliJ IDEA 2018.3.1\bin\idea64.exe.vmoptions

-Dfile.encoding=UTF-8

7. 創(chuàng)建多模塊項(xiàng)目

右鍵父項(xiàng)目-> New Module -> quickstart -> 填入ArtifactId

每個(gè)模塊都是一個(gè)獨(dú)立的maven工程,擁有自己的pom

8. 常用快捷鍵
  • Ctrl+Z 撤銷(xiāo)

  • Ctrl+Shift+Z 撤銷(xiāo) "撤銷(xiāo)" (沖正)

  • Ctrl + D 復(fù)制當(dāng)前行并粘貼到下一行

  • Ctrl + Y 刪除當(dāng)前行

  • idea 不用選中也可以復(fù)制、剪切。Ctrl + C/X 自動(dòng)復(fù)制/剪切 光標(biāo)所在行

  • 查找:

    • Ctrl+F : 當(dāng)前文件中查找
    • double Shift: 全局查找文件(類文件等文件)
    • Ctrl + Shift + F : 全局查找文本
    • Ctrl + R 當(dāng)前文件檢索替換
    • Ctrl + Shift + R 全局查找替換
    • Alt + F7 查找類被調(diào)用的地方 (類似eclipse中call hierarchy)
    • Ctrl + Alt + B 快速定位當(dāng)前方法的實(shí)現(xiàn)
  • Alt + insert 生成構(gòu)造方法、get/set、實(shí)現(xiàn)接口方法等代碼

  • 塊注釋 : Ctrl + Shift + /

  • 格式化(format) : Ctrl + Alt + L

  • 導(dǎo)包優(yōu)化import : Alt + Ctrl+ O

  • 重命名文件: Shift + F6

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容