#1 Extracting method/parameter

During the refactoring, one of the most commonly thing to do is to extract something. With this shortcuts you can do it quickly with the whole methods…

macOS: Cmd + Alt+ M

Windows: Ctrl + Alt + M

… or single parameters:

macOS: Cmd + Alt+ P

Windows: Ctrl + Alt + P

Or more generally with Cmd+Alt also variables (V), fields (F), constants (C), etc. Now go and extract some kitties! 🐱

#2 Surround with

You can also surround some code with the popular statements — if/else, try/catch, comments block. Look at the example:

macOS: Cmd + Alt+ T

Windows: Ctrl + Alt + T

#3 Smart line split & join

If you need to split the line, but you want cursor to stay in the same position, you can use smart line split:

macOS: Cmd + Enter

Windows: Ctrl + Enter

Or if you want to join lines in the similar way, you may use smart line join:

macOS: Shift + Ctrl + J

Windows: Shift + Ctrl + J

#4 Moving statements

If you need to change e.g. order of methods, here’s one very handy shortcut to do it:

macOS: Shift + Cmd + ↓/↑

Windows: Shift + Ctrl + ↓/↑

You can use it also to change order of lines, fields, method invocations, classes and many more!