13 Simple Ways To Edit Code Faster in IntelliJ IDEA

13 Simple Ways To Edit Code Faster in IntelliJ IDEA

Are you making the most of IntelliJ IDEA to speed up basic code editing? You’d be surprised how many time saving shortcuts are available for basic navigating, highlighting, and moving code in the editor.

Here’s a run-through of the 13 most important, with both Windows and Mac shortcuts. How many of these shortcuts do you know?

Jump to editor to start coding

How do you actually get to the editor in IntelliJ IDEA?

Wherever you are in the IDE, just hit Escape to move focus to the editor. Much quicker than using a mouse!

If you see an empty screen, then you just need to open a class. Hit Ctrl + N and enter the class name.

Navigate your code faster

Now you’re ready to code, but how to navigate around? You could point and click, but that wastes time moving your hand away from the keyboard.

Better to use the arrow keys for fine grained control of the caret position. 

Or to skip entire words hold Ctrl as you press and arrow keys.

You can also hit Home to jump to the start and End to the end of a line. 

Yes, there’s a reason these keys all hang out together on the keyboard. Use them!

Let’s say you’ve got a larger class and need to jump between methods.

That’s easy with Alt + ↑ for previous, and Alt + ↓ for next methods.

Another option is Ctrl + F12 which shows the class structure. Hit the and arrows to choose the method, then enter to navigate to it.

Quick code selection

To select a portion of a line that maybe you want to replace, delete, or copy, hold down Shift and press or arrow keys.

And hold down Ctrl as you do that to jump entire words.

Another way to select text is with Ctrl + W, IntelliJ IDEA’s extend selection tool. It progressively selects more and more code.

By the way, whatever selection you have, just hit Escape, , or to deselect it and continue.

Copy a line like a pro

But whatever you do, don’t highlight a whole line to copy and paste it. Way too slow! Instead, there’s a keystroke-killing shortcut, Ctrl + D. It copies the line your caret is on.

Just remember D for duplicate.

And opposite is Ctrl + Y to delete a line. Nice!

Bulk move code

A common situation is when a line of code is in the wrong place. No need for cut and paste. Instead, hold Ctrl, Shift and use the and arrows to move the line.

You can even do the same thing with multiple lines at once!

Get me out of here!

And remember, if at any time you make a mistake just hit Ctrl + Z to undo.

And then when you realise you actually didn’t make a mistake, Ctrl + Shift + Z to redo.

Powerful bonus tip

OK, you probably knew that one. Here’s a bonus tip then. It’s a powerful one, so be careful. 💪

Highlight some text using the techniques mentioned earlier, then hit Alt + J. This additionally selects the next occurrence of the text. Press again to select more occurrences.

You can even make edits in multiple positions at the same time. I did say it was powerful!

When you’re done, hit Escape to get out of that mode and back to dry land.

Shortcut summary table

Shortcut nameWindows shortcutMac shortcut
1. Go to editorEscEsc
2. Go to classCtrl + N⌘ O
3. Skip wordCtrl + ←/→⌥ + ←/→
4. Line start / endHome / EndFn ← / Fn →
5. Previous / next methodAlt + ↑ / Alt + ↓⌃ ↑ / ⌃ ↓
6. File structure popupCtrl + F12⌘ F12
7. Simple select textShift + Arrow KeyShift + Arrow Key
8. Extend selectionCtrl + W⌥ ↑
9. Duplicate lineCtrl + D⌘ D
10. Delete lineCtrl + Y⌘ Delete
11. Move statementCtrl + Shift + ↑/↓⇧ ⌘ ↑/↓
12. UndoCtrl + Z⌘ Z
13. RedoCtrl + Shift + Z⇧ ⌘ Z
Bonus: Next occurenceAlt + J⌃ G

Resources

Did I miss something? If there’s a handy shortcut you use all the time, please share it down below in the comments.

13 Simple Ways To Edit Code Faster in IntelliJ IDEA

2 thoughts on “13 Simple Ways To Edit Code Faster in IntelliJ IDEA

  1. Oh, yes, “Navigate Back”. On my mac, I have set an own shortcut for this. It helps, when you go into the code “What’s this, what’s that, …” and you want to go the same way back.

Leave a Reply

Your email address will not be published.

Scroll to top