IntelliJ IDEA: Move line?
I really like IntelliJ IDEA's "Move statement" shortcut (Ctrl + Shift + ↑/↓). However -- I am not sure if this is a bug releated to ActionScript edi开发者_如何学JAVAting only -- move statement is not always what I want and sometimes it is not correct when editing AS code.
So I just want to move a block of lines up/down. The Eclipse shortcut is Alt + ↑/↓ and does not move statement-wise. Is there an equivalent in IntelliJ IDEA?
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 + ↓
shift + alt + ↑/↓
you can find All short cuts HERE
https://resources.jetbrains.com/storage/products/intellij-idea/docs/IntelliJIDEA_ReferenceCard.pdf
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...
The LineMover plug-in works very well and is an acceptable solution.
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.
try command+shift+up/down this will auto adjust the indentation
精彩评论