IntelliJ IDEA 2020.3 Help


The Groovy plugin is bundled with IntelliJ IDEA and enabled by default.

IntelliJ IDEA supports the latest stable version of Groovy and Groovy 3 syntax.

User interface

The user interface for Groovy looks similar to a regular one. However, it includes the Groovy console that you can open from the main menu (Tools | Groovy Console).

User interface for Groovy

The most interesting part of the user interface is the IntelliJ IDEA Editor since it lets you invoke almost any IDE feature without leaving it, which helps you organize a layout where you have more screen space because auxiliary controls like toolbars and windows are hidden.

Accessing a tool window via its shortcut moves the input focus to it, so you can use all keyboard commands in its context. When you need to go back to the editor, press Escape .

Below is a list of shortcuts that invoke the tool windows you will most often need:

Tool Window Shortcut
Project Alt+1
Version Control Alt+9
Run Alt+4
Debug Alt+5
Terminal Alt+F12
Editor Escape

When you want to focus on the code, try the Distraction Free Mode. It removes all toolbars, tool windows, and editor tabs. To switch to this mode, on the main menu select View | Appearance | Enter Distraction Free Mode.

An alternative to the Distraction Free Mode may be hiding all tool windows by pressing Ctrl+Shift+F12 . You can restore the layout to its default by pressing this shortcut once again.

The Navigation Bar is a compact alternative to the Project tool window. To access the Navigation Bar, press Alt+Home .

Navigation bar

Most components in IntelliJ IDEA (both tool windows and popups) provide speed search. This feature allows you to filter a list, or navigate to a particular item by using a search query.

Speed search

For more details, refer to Overview of the user interface , Editor basics , and Tool windows .

Editor basics

A work in the editor is standard for Groovy as for any other languages with all the shortcuts offered by IntelliJ IDEA.

Check the following most useful editor shortcuts:

Action Description
Move the current line of code Ctrl+Shift+Up Ctrl+Shift+Down
Duplicate a line of code Ctrl+D
Remove a line of code Ctrl+Y
Comment or uncomment a line of code Ctrl+/
Comment a block of code Ctrl+Shift+/
Find in the currently opened file Ctrl+F
Find and replace in the current file Ctrl+R
Next occurrence F3
Previous occurrence Shift+F3
Navigate between opened tabs Alt+Right Alt+Left
Navigate back/forward Ctrl+Alt+Left Ctrl+Alt+Right
Expand or collapse a code block in the editor Ctrl+NumPad + Ctrl+NumPad -
Generate Alt+Insert
Surround with Ctrl+Alt+T
Highlight usages of a symbol Ctrl+F7

To expand a selection based on grammar, press Ctrl+W . To shrink it, press Ctrl+Shift+W .

IntelliJ IDEA can select more than one piece of code at a time. You can select next occurrence via Alt+J and deselect by pressing Alt+Shift+J . You can even select all occurrences at once, by pressing Ctrl+Alt+Shift+J .

For more details, refer to Editor basics.

With IntelliJ IDEA you don't need to save code changes every time since you can undo refactorings and revert changes from Local History.

Groovy code style and formatting

IntelliJ IDEA automatically applies a code style you've configured in the Groovy code style settings as you edit.

Groovy code style settings

Check the following formatting shortcuts:

Action Shortcut
Reformat code Ctrl+Alt+L
Auto-indent lines Ctrl+Alt+I
Optimize imports Ctrl+Alt+O

Note that by default, IntelliJ IDEA uses regular spaces for indents instead of tabs. If you have files with lots of indents, you may want to optimize their size by enabling the Use tab character option located in Settings | Editor | Code Style | Groovy.

For more details, refer to Reformatting Source Code.

Last modified: 20 July 2020