IntelliJ常用快捷鍵及配置
目錄:
1、常用快捷鍵:
2、常用配置:
1、常用快捷鍵:
(1)psvm:創建main函數
(2)fori:for (int i = 0; i < ; i++) {}
(3)sout:System.out.println()
(4)ctrl + n:查找類
(5)ctrl + shift + n:查找文件
(6)ctrl + alt + l:格式化代碼
(7)ctrl + alt + o:格式化import列表,刪除掉已導入但未使用的包
(8)ctrl + x:剪切當前行,光標在行的任意位置
(9)ctrl + d:復制當前行,並粘貼到下一行
(10)ctrl + /:注釋或取消注釋//
(11)ctrl + shift + /:選中要注釋或取消注釋的區域后使用/* */
(12)ctrl + p:方法參數提示
(13)ctrl + alt + space:類名或接口名提示
(14)shift + F2:鼠標光標移動到有錯誤代碼的位置
(15)ctrl + shift + enter:自動補全末尾的字符
(16)shift + F6:改名,類名,變量名,包名,方法名等等
(17)ctrl + j:查看所有模板
圖1.1 截圖1
(18)ctrl + w:自動按語法選中代碼
圖1.2 截圖2
(19)ctrl + shift + w:自動反向選中代碼
(20)ctrl + left/right:移動光標到前/后單詞
(21)ctrl + y:刪除行
(22)shift + shift:可以搜索所有東西,包括類、資源、配置項、方法等
(23)ctrl + h:查看類層次窗口
(24)ctrl + F12:查看當前類的所有方法
(25)ctrl + f:在當前窗口查找關鍵字
(26)ctrl + shift + f:在指定窗口查找關鍵字
(27)ctrl + shift + F10:運行當前類
(28)ctrl + tab:切換到其它目錄
(29)alt + insert:創建構造方法、重寫方法等
圖1.3 截圖3
(30)shift + enter:光標從當前位置往下創建一行,並移到下一行起始處
2、常用配置:
(1)設置字體:
File -> Settings -> Editor -> Font,設置為Consolas字體。
(2)設置IDEA字符編碼:
File -> Settings ->Editor -> Code Style -> File Encoding,將上面的Global Encoding和Project Encoding都設置為UTF-8編碼,以及下面的Properties Files的配置文件編碼也改為UTF-8。
(3)設置智能提示忽略大小寫:
File -> Settings ->Editor -> General -> Code Completion,將Case sensitive completion設置為None。
(4)配置git:
File -> Settings -> Version Control -> Git。
圖2.1 截圖4
(5)配置背景主題:
File -> Settings -> Appearance & Behavior,設置UI Options中Theme為Darcula的黑色背景。
(6)配置Maven:
File -> Settings -> Build,Execution,Deployment -> Build Tools -> Maven。
圖2.2 截圖5
(7)配置hints:
File -> Settings -> Editor -> General -> Appearance,將show parameter name hints的勾選去掉,即不顯示方法參數提示。
(8)配置啟動時打開的項目:
File -> Settings -> Appearance & Behavior -> System Settings,將Startup/Shutdown中的Reopen last project on startup的勾選去掉,即啟動時不自動打開上次項目,而是讓我們自己選擇。
(9)設置幾時自動換行:
File -> Settings -> Editor -> Code Style,將Right Margin改為120,即120個字符時會自動換行。
圖2.3 截圖6