Font
Font:Monaco
Size:16
Line spacing: 1.3
Appearance
Theme:Darcula
勾選Use dark window headers
第三方主題


下載檔案是一個jar包,然後在File -> import setting...
,匯入jar包



可以在Preferences | Editor | Color Scheme | General
中選擇已安裝的主題,並可以在已有主題上進行DIY
開啟編輯器,工程選擇
Preferences | Appearance & Behavior | System Settings
,關閉Reopen last project on startup
,每次開啟編輯器時,需要選擇進入的工程而不是直接最近的
目錄分類
在專案工程中,標記為Sources Root
的目錄中,右鍵可以新建Package
、Java Class
,普通Directory
不能建立這些檔案。

Mark Directory as | Sources Root
進行標記
隱藏.idea
目錄
Preferences | Editor | File Types
中的Ignore files and folders
新增.idea
隱藏out目錄(位元組碼輸出目錄)
工程Projiect -> 設定 -> Show Excluded Files

自動匯入和自動刪除無用的包
自動刪除無用的包Import(未被引用),以及自動Import填充尚未匯入的包
Preferences | Editor | General | Auto Import
勾選Add unambiguous imports on the fly
和Optimize imports on the fly
程式碼提示不區分大小寫
Preferences | Editor | General | Code Completion
取消勾選Match case
方法引數提示
Keymap -> 搜尋Parameter Info -> cmd + P
提示程式碼
Keymap -> 搜尋basic(Completion) -> option + /
模板
Preferences | Editor | Live Templates
中有很多程式碼模板,提高編碼速度

souti
然後tab
就可以使用
工具欄的顯示與隱藏
View -> Toolbar,是否顯示工具欄
顯示方法線
Preferences | Editor | General | Appearance
勾選Show method separators
設定指定程式碼型別進行預設摺疊或是展開
Preferences | Editor | General | Code Folding
進行勾選
修改cmd + D
為複製所選的行數完整內容,而不是所選中的內容
Preferences | Keymap
搜尋Duplicate

編輯器視窗開啟過多檔案時,Tab多行展示
Preferences | Editor | General | Editor Tabs
,Placement
選擇Top
,不勾選Show tabs in one row
編輯器視窗不顯示Editor Tabs
Preferences | Editor | General | Editor Tabs
,Placement
選擇None
,節省空間,配合cmd + E
來進行最近開啟檔案的切換
設定cmd + E
檔案個數和cmd + shift + V
貼上緩衝區條數
Preferences | Editor | General

編輯視窗左側右鍵設定
設定檔案的軟換行、檔案程式碼提交記錄、程式碼行數、程式碼縮排提示、麵包屑顯示
編輯視窗拆分
Window | Editor Tabs | Split *
設定程式碼檢查等級,針對當前檔案
IntelliJ IDEA 對於編輯大檔案並沒有太大優勢,很卡,原因就是它有各種檢查,這樣是非常耗記憶體和 CPU 的,所以為了能加快大檔案的讀寫,一般會暫時性設定為 None。
- Inspections 為最高等級檢查,可以檢查單詞拼寫,語法錯誤,變數使用,方法之間呼叫等。
- Syntax 可以檢查單詞拼寫,簡單語法錯誤。
- None 不設定檢查。
還可以進行自定義配置
摺疊程式碼並且新增標籤
選中要被摺疊的程式碼按cmd + option + T
快捷鍵,選擇<editor-fold...> Comments
選擇自定義摺疊程式碼區域功能
給選中的內容新增首尾的註釋標識,可以摺疊也可以生成懷繞程式碼
本地檔案歷史記錄
檔案上或者檔案中右鍵,Local History,檢視本地修改的記錄
Java檔案中import的設定
Preferences | Editor | Code Style | Java
選擇import
,當我們 Java 類中匯入的某個包下類超過這裡設定的指定個數,就會換成用 * 號來代替,以及import包順序的問題

設定Java原始檔中,tab提示線
Preferences | Editor | Code Style | Java
選擇Tabs and Indents
,勾選Use tab character
游標定位在程式碼的末尾
Preferences | Editor | General
,在Virtual Space
中不勾選Allow placement of caret after end of line
程式碼行寬度超出限制時設定自動換行
當我們使用IDE寫程式碼時,為了保證程式碼的可閱讀性和優雅性,通常會藉助IDE的程式碼風格設定功能,令IDE智慧完成的程式碼部分或者格式化輸入的程式碼,可以按照預期的格式輸出。其中有一項設定就是限制一行程式碼的寬度,以IDEA舉例,預設限制為120。 樓主這裡設定的是100。
-
在輸入程式碼時觸發,隨著輸入的字元的增加,當程式碼寬度到達界線時,IDEA會自動將程式碼換行。
Preferences | Editor | Code Style
-
在格式化Java程式碼時觸發,確保程式碼沒有超過寬度界線。
Preferences | Editor | Code Style | Java
選擇Wrapping and Braces
,勾選Ensure right margin is not exceeded
修改/新增新建檔案模板
Preferences | Editor | File and Code Templates
,選擇Files
,點選+
,填寫Name、Extension和檔案初始內容,然後就可以在新建時選擇該模板了。
SSH遠端連線linux虛擬機器
Tools | Deployment | Configuration...
設定
設定Java程式碼的註釋風格
Preferences | Editor | Code Style | Java
選擇Code Generation

tomcat的配置
- 下載tomcat
- 在
Preferences | Build, Execution, Deployment | Application Servers
設定
將專案部署到tomcat上
點選除錯中的edit configuration


自動隱藏文件註釋,讓原始碼閱讀更為清爽!
Preferences | Editor | General | Code Folding
勾選Documentation comments
,快速一鍵開啟全部註釋,則單擊滑鼠右鍵,選擇Folding -> Expand Doc comments
關閉Intellij IDEA自動更新
Preferences | Appearance & Behavior | System Settings | Updates
,取消勾選Automatically check updates for
檔案編碼設定
Preferences | Editor | File Encodings
- Global Encoding:UTF-8
- Projectt Encoding:UTF-8
- Default encoding for properties files:UTF-8
- 勾選上Transparent native-to-ascii conversion
使用快捷鍵移動分割線
你想完整的看到類的名字,該怎麼做。一般都是使用滑鼠來移動分割線,但是這樣子效率太低了。可以使用cmd + 1
把滑鼠焦點定位到project檢視裡,然後直接使用cmd + shift + 左右箭頭
來移動分割線。
進入idea和離開idea時,設定當前使用的輸入法

快速選中當前游標所在的單詞,連續操作會選中下面的單詞
同vs code中的cmd + D
,Preferences | Keymap
,搜尋add select for next occurrence
control + G
定位當前檔案在project檢視的位置
檢視當前檔案在Project中的位置Navigate | Select In...
,快捷鍵是option + F1


cmd + \
專案執行中的應用更新策略

- On 'Update' actions
執行更新操作時所做的事情,一般選擇'Update classes and resources',即更新類和資原始檔 一般配合熱部署外掛會更好用,如JRebel,這樣就不用每次更改程式碼後還要去重新啟動服務。
- On frame deactivation
在IDEA視窗失去焦點時觸發,即一般你從idea切換到瀏覽器的時候,idea會自動幫你做的事情, 一般可以設定Do nothing,頻繁切換會比較消耗資源的。
神奇的Inject language
如果你使用IDEA在編寫JSON字串的時候,然後要一個一個去轉義雙引號的話,就實在太不應該了,又煩又容易出錯。在IDEA可以使用Inject language幫我們自動轉義雙引號。
先寫一個空字串

option + enter
,彈出inject language檢視,並選中


option + enter
就可以看到下圖選擇項


cmd + W
關閉即可
刪除當前一整行
在不選中的情況下:cmd + X
,這本來是剪下當前,只要不選中程式碼按cmd + X
算是剪下當前一整行。還有一個真正是刪除當前一整行的是cmd + Y
,這個Y鍵比較遠,所以我還是感覺cmd + X
好使。
降低autowired檢測級別
工程可以正常執行,但是有提示

- Could not autowire. No beans of 'PortalProductDao' type found.
- Inspection info:Checks autowiring problems in a bean class.
解決方法:Preferences | Editor | Inspections
中選擇Spring | Spring Core | Code | Autowiring for Bean Class
降低檢測級別
