1. 程式人生 > >IDEA的使用:7.常用的快捷鍵

IDEA的使用:7.常用的快捷鍵

IDEA的快捷鍵是它吸引了一大波粉絲的原因之一,現在來簡單聊聊IDEA的快捷鍵。

在IDEA中,有如下常用的快捷鍵:

1

執行(run)   

alt+r

2

提示補全 (Class Name Completion)                

alt+/

3

單行註釋

ctrl + /

4

多行註釋

ctrl + shift + /

5

向下複製一行 (Duplicate Lines)               

ctrl+alt+down

6

刪除一行或選中行 (delete line)             

ctrl+d

7

向下移動行(move statement down)                

alt+down

8

向上移動行(move statement up)                  

alt+up

9

向下開始新的一行(start new line)                

shift+enter

10

向上開始新的一行 (Start New Line before current)     

ctrl+shift+enter

11

如何檢視原始碼 (class)                        

ctrl + 選中指定的結構

ctrl + shift + t

12

萬能解錯/生成返回值變數

alt + enter

13

退回到前一個編輯的頁面 (back)                 

alt + left

14

進入到下一個編輯的頁面(針對於上條) (forward)  

alt + right

15

檢視繼承關係(type hierarchy)                  

F4

16

格式化程式碼(reformat code)                     

ctrl+shift+F

17

提示方法引數型別(Parameter Info)                

ctrl+alt+/

18

複製程式碼

ctrl + c

19

撤銷

ctrl + z

20

反撤銷

ctrl + y

21

剪下

ctrl + x

22

貼上

ctrl + v

23

儲存

ctrl + s

24

全選

ctrl + a

25

選中數行,整體往後移動

tab

26

選中數行,整體往前移動

shift + tab

27

檢視類的結構:類似於 eclipse outline          

ctrl+o

28

重構:修改變數名與方法名(rename)                   

alt+shift+r

29

大寫轉小寫/小寫轉大寫(toggle case)              

ctrl+shift+y

30

生成構造器/get/set/toString                       

alt +shift + s

31

檢視文件說明(quick documentation)              

F2

32

收起所有的方法(collapse all)                 

alt + shift + c

33

開啟所有方法(expand all)                        

alt+shift+x

34

開啟程式碼所在硬碟資料夾(show in explorer)         

ctrl+shift+x

35

生成 try-catch (surround with)            

alt+shift+z

36

區域性變數抽取為成員變數(introduce field)             

alt+shift+f

37

查詢/替換(當前)                               

ctrl+f

38

查詢(全域性)                                 

ctrl+h

39

查詢檔案

double Shift

40

檢視類的繼承結構圖(Show UML Diagram)   

ctrl + shift + u

41

檢視方法的多層重寫結構(method hierarchy)        

ctrl+alt+h

42

新增到收藏(add to favorites)

ctrl+alt+f

43

抽取方法(Extract Method)                       

alt+shift+m

44

開啟最近修改的檔案(Recently Files) 

ctrl+E

45

關閉當前開啟的程式碼欄(close)                     

ctrl + w

46

關閉開啟的所有程式碼欄(close all)            

ctrl + shift + w

47

快速搜尋類中的錯誤(next highlighted error)         

ctrl + shift + q

48

選擇要貼上的內容(Show in Explorer)             

ctrl+shift+v

49

查詢方法在哪裡被呼叫(Call Hierarchy)                 

ctrl+shift+h

對於部分從Eclipse或MyEclipse轉IDEA的程式設計師而言,可能會覺得IDEA用不順手,這時IDEA也提供了和Eclipse相同的快捷鍵方式,具體設定如下圖所示:

也可以通過匯入jar包的方式來修改快捷鍵:

這裡為大家提供一個和Eclipse保持一致的jar包,大家可以下載後進行匯入:

連結:https://pan.baidu.com/s/10OXHj32sef2slmil9Y1wHQ 密碼:unke