移动线路?

我真的很喜欢 IntelliJ IDEA 的“移动语句”快捷键(Ctrl + Shift + /)。但是——我不确定这是否只是 ActionScript 编辑的错误—— move 语句并不总是我想要的,有时在编辑 AS 代码时也不正确。

所以我只需要移动一组线条上下移动。Eclipse 快捷方式是 Alt + /,并且不按语句方式移动。在 IntelliJ IDEA 中是否存在一个等价物?

59394 次浏览

You can move several lines together with move statement. Are you trying to move partial lines? I don't think there's a way in Idea.

The LineMover plug-in works very well and is an acceptable solution.

Open Setings -> Keymap then search for "move line" via the upper right searchbox.

Under the Code folder you'll see:

  • Move Statement Down
  • Move Statement Up
  • Move Line Down
  • Move Line Up

The actions you're looking for are (as you may guess) the move line actions.

As other people have said this is already available as a command. You can configure the short cut to your liking, but by default (at least in IntelliJ 10) it is bound to ALT + SHIFT + and ALT + SHIFT +

Please find some useful shortcut for IntelliJ:


(1) IntelliJ Debugger

Step over (Go To next Step or line) : F8

Step into (Go into function) : F7

Smart step into : Shift + F7

Step out : Shift + F8

Run to cursor : Alt + F9

Evaluate expression : Alt + F8

Resume program : F9 [Mac = Cmd + ALT + R]

Toggle breakpoint : Ctrl + F8 [Mac = Cmd + F8]

View breakpoints : Ctrl + Shift + F8 [Mac = Cmd + Shift + F8]


(2) Open Specific File

Ctrl + Shift + N


(3) Open All Methods Implemented in class

Open specific class and press,

Ctrl + F12


(4) Go to Specific Line Number

Ctrl + G


(5) Method Implementation and Declaration

Declaration : Ctrl + B

Implementation : Ctrl + Alt + B

Response Type Declaration : Ctrl + Shift + B

Super class override Method : Ctrl + U


(6) Reformate Code

Ctrl + Alt + L


(7) Import relevant class

Click on relevant class (Red color field) and press,

Alt + Enter

Select valid class as per requirement


(8) Hierarchy of method calls

Select specific method and press,

Ctrl + Alt + H


(9) Comment In Code

Single Line : Select specific line and press, Ctrl + /

Multiple Line : Select Multiple Line and Press, Ctrl + Shift + /

(Note : Same operation for uncomment the code)


(10) Display Line Number

Hit Shift twice > write "line" > Show Line Numbers (the line doesn't have the toggle)

View > Active Editor > Show Line Number


(11) Code Selection

Full class selection : Ctrl + A Method Selection : Select Method Name and press, Ctrl + W


(12) Basic Code Completion

To complete methods, keywords etc press,

Ctrl + Space


(13) Code Copy and Paste

Copy : Ctrl + C

Paste : Ctrl + V


(14) Search Operation

Specific File : Ctrl + F

Full Project : Ctrl + Shift + F


(15) Switcher Popup

Open Switcher Popup : Ctrl + Tab

Continue press Ctrl and use ↑/↓/←/→ for move one place to another


(16) Forward Move & Backward Move

Backward : Ctrl + Alt + ← (Left-Arrow)

Forward : Ctrl + Alt + → (Right-Arrow)


(17) Next/previous highlighted error

F2 or (Shift + F2)


(18) Open Java Doc

Select specific method name and press,

Ctrl + Q


(19) Find All commands

Ctrl + Shift + A


(20) Move Line Up/Down

shift + alt + ↑/↓

Thanks...

try command+shift+up/down this will auto adjust the indentation