# Groovy

IntelliJ IDEA supports the [latest stable version](http://groovy-lang.org/download.html) of Groovy and Groovy 4 syntax.

Procedure: Enable the Groovy plugin

This functionality relies on the [Groovy](https://plugins.jetbrains.com/plugin/20393-groovy)  plugin, which  is bundled and enabled in IntelliJ IDEA   by default. If the relevant features are not available, make sure that you did not disable the plugin.

1. Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) to open settings and then select `Plugins`.

2. Open the Installed tab, find the Groovy plugin, and select the checkbox next to the plugin name.

## User interface

The user interface for Groovy looks similar to a regular one. However, it includes the [Groovy console](launching-groovy-interaction-console.html) that you can open from the main menu (`Tools | Groovy Console`).

![User interface for Groovy](https://resources.jetbrains.com.cn/help/img/idea/2026.2/editor_groovy.png)

The most interesting part of the user interface is the IntelliJ IDEA [Editor](using-code-editor.html) 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` (Windows), `⎋` (macOS), `⎋` (IntelliJ IDEA Classic (macOS)), `⎋` (macOS System Shortcuts), `Escape` (XWin), `Escape` (GNOME), `Escape` (KDE), `Escape, Escape` (Emacs), `Escape` (Sublime Text), `⎋` (Sublime Text (macOS)), `Escape` (NetBeans), `Escape` (Visual Studio), `⎋` (Visual Studio (macOS)), `Escape` (Eclipse), `⎋` (Eclipse (macOS)).

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

| Tool Window | Shortcut |
| --- | --- |
| Project |  `Alt+1` (Windows), `⌘ 1` (macOS), `⌘ 1` (IntelliJ IDEA Classic (macOS)), `⌘ 1` (macOS System Shortcuts), `Alt+1` (XWin), `Alt+1` (GNOME), `Alt+1` (KDE), `Alt+1` (Emacs), `Alt+1` (Sublime Text), `⌘ 1` (Sublime Text (macOS)), `Ctrl+1` (NetBeans), `Ctrl+Alt+L` (Visual Studio), `⌘ ⌥ L` (Visual Studio (macOS)), `Alt+1` (Eclipse), `Alt+1` (Eclipse (macOS))  |
| Version Control |  `Alt+9` (Windows), `⌘ 9` (macOS), `⌘ 9` (IntelliJ IDEA Classic (macOS)), `⌘ 9` (macOS System Shortcuts), `Alt+9` (XWin), `Alt+9` (GNOME), `Alt+9` (KDE), `Alt+9` (Emacs), `Alt+9` (Sublime Text), `⌘ 9` (Sublime Text (macOS)), `Alt+9` (NetBeans), `Alt+9` (Visual Studio), `⌘ 9` (Visual Studio (macOS)), `Alt+9` (Eclipse), `⌘ 9` (Eclipse (macOS))  |
| Run |  `Alt+4` (Windows), `⌘ 4` (macOS), `⌘ 4` (IntelliJ IDEA Classic (macOS)), `⌘ 4` (macOS System Shortcuts), `Alt+4` (XWin), `Alt+4` (GNOME), `Alt+4` (KDE), `Alt+4` (Emacs), `Alt+4` (Sublime Text), `⌘ 4` (Sublime Text (macOS)), `Alt+4` (NetBeans), `Alt+4` (Visual Studio), `⌘ 4` (Visual Studio (macOS)), `Alt+4` (Eclipse), `⌘ 4` (Eclipse (macOS))  |
| Debug |  `Alt+5` (Windows), `⌘ 5` (macOS), `⌘ 5` (IntelliJ IDEA Classic (macOS)), `⌘ 5` (macOS System Shortcuts), `Alt+5` (XWin), `Alt+5` (GNOME), `Alt+5` (KDE), `Alt+5` (Emacs), `Alt+5` (Sublime Text), `⌘ 5` (Sublime Text (macOS)), `Alt+5` (NetBeans), `Alt+5` (Visual Studio), `⌘ 5` (Visual Studio (macOS)), `Alt+5` (Eclipse), `⌘ 5` (Eclipse (macOS))  |
| Terminal |  `Alt+F12` (Windows), `⌥ F12` (macOS), `⌥ F12` (IntelliJ IDEA Classic (macOS)), `⌘ ⌃ T` (macOS System Shortcuts), `Alt+F12` (XWin), `Alt+F12` (GNOME), `Alt+F12` (KDE), `Alt+F12` (Emacs), `Alt+F12` (Sublime Text), `⌥ F12` (Sublime Text (macOS)), `Alt+F12` (NetBeans), `Ctrl+Alt+1` (Visual Studio), `⌘ ⌃ 1` (Visual Studio (macOS)), `Alt+F12` (Eclipse), `⌥ F12` (Eclipse (macOS))  |
| Editor |  `Escape` (Windows), `⎋` (macOS), `⎋` (IntelliJ IDEA Classic (macOS)), `⎋` (macOS System Shortcuts), `Escape` (XWin), `Escape` (GNOME), `Escape` (KDE), `Escape, Escape` (Emacs), `Escape` (Sublime Text), `⎋` (Sublime Text (macOS)), `Escape` (NetBeans), `Escape` (Visual Studio), `⎋` (Visual Studio (macOS)), `Escape` (Eclipse), `⎋` (Eclipse (macOS))  |

When you want to focus on the code, try the [Distraction Free Mode](ide-viewing-modes.html#distraction-free). It removes all toolbars, tool windows, and editor tabs. To switch to this mode, go to View | Appearance | Enter Distraction Free Mode in the main menu.

An alternative to Distraction Free Mode may be hiding all tool windows by pressing `Ctrl+Shift+F12` (Windows), `⌘ ⇧ F12` (macOS), `⌘ ⇧ F12` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ F12` (macOS System Shortcuts), `Ctrl+Shift+F12` (XWin), `Ctrl+Shift+F12` (GNOME), `Ctrl+Shift+F12` (KDE), `Ctrl+Shift+F12` (Emacs), `Ctrl+Shift+F12` (Sublime Text), `⌘ ⇧ F12` (Sublime Text (macOS)), `Ctrl+Shift+F12` (NetBeans), `Ctrl+Shift+F12` (Visual Studio), `⌘ ⇧ F12` (Visual Studio (macOS)), `Ctrl+Shift+F12` (Eclipse), `⌘ ⇧ F12` (Eclipse (macOS)). 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](project-tool-window.html). To access the Navigation Bar, press `Alt+Home` (Windows), `⌘ ↑` (macOS), `⌥ Home` (IntelliJ IDEA Classic (macOS)), `⌘ ⌃ ↑` (macOS System Shortcuts), `Alt+Home` (XWin), `Alt+Home` (GNOME), `Alt+Home` (KDE), `Alt+Home` (Emacs), `Alt+Home` (Sublime Text), `⌥ Home` (Sublime Text (macOS)), `Alt+Home` (NetBeans), `Ctrl+F2` (Visual Studio), `⌘ F2` (Visual Studio (macOS)), `Alt+Home` (Eclipse), `⌘ ⌥ B` (Eclipse (macOS)).

![Navigation bar](https://resources.jetbrains.com.cn/help/img/idea/2026.2/groovy_navigation_bar.png)

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

![Speed search](https://resources.jetbrains.com.cn/help/img/idea/2026.2/groovy_search_for_window.png)

> **Tip:**
> When you don't know the shortcut for an action, try using the Find action feature by pressing `Ctrl+Shift+A` (Windows), `⌘ ⇧ A` (macOS), `⌘ ⇧ A` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ P` (macOS System Shortcuts), `Ctrl+Shift+A` (XWin), `Ctrl+Shift+A` (GNOME), `Ctrl+Shift+A` (KDE), `Escape, X` (Emacs), `Ctrl+Shift+P` (Sublime Text), `⌘ ⇧ P` (Sublime Text (macOS)), `Ctrl+I` (NetBeans), `Ctrl+Shift+A` (Visual Studio), `⌘ ⇧ A` (Visual Studio (macOS)), `Ctrl+Shift+A` (Eclipse), `⌘ 3` (Eclipse (macOS)). Start typing to find an action by its name, see its shortcut or call it.

For more information, refer to [User interface](guided-tour-around-the-user-interface.html) , [Editor basics](using-code-editor.html) , and [Tool windows](tool-windows.html) .

## 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` (Windows), `⌘ ⇧ ↑` (macOS), `⌘ ⇧ ↑` (IntelliJ IDEA Classic (macOS)), `⌃ ⇧ ↑` (macOS System Shortcuts), `Ctrl+Shift+Up` (XWin), `Ctrl+Shift+Up` (GNOME), `Ctrl+Shift+Up` (KDE), `Ctrl+Shift+Up` (Emacs), `Ctrl+Shift+Up` (Sublime Text), `⌘ ⇧ ↑` (Sublime Text (macOS)), `Alt+Shift+Page Up` (NetBeans), `Ctrl+Alt+Shift+Up` (Visual Studio), `⌃ ⌥ ⇧ ↑` (Visual Studio (macOS)), `Alt+Up` (Eclipse), `⌥ ↑` (Eclipse (macOS)) `Ctrl+Shift+Down` (Windows), `⌘ ⇧ ↓` (macOS), `⌘ ⇧ ↓` (IntelliJ IDEA Classic (macOS)), `⌃ ⇧ ↓` (macOS System Shortcuts), `Ctrl+Shift+Down` (XWin), `Ctrl+Shift+Down` (GNOME), `Ctrl+Shift+Down` (KDE), `Ctrl+Shift+Down` (Emacs), `Ctrl+Shift+Down` (Sublime Text), `⌘ ⇧ ↓` (Sublime Text (macOS)), `Alt+Shift+Page Down` (NetBeans), `Ctrl+Alt+Shift+Down` (Visual Studio), `⌃ ⌥ ⇧ ↓` (Visual Studio (macOS)), `Alt+Down` (Eclipse), `⌥ ↓` (Eclipse (macOS))  |
| Duplicate a line of code |  `Ctrl+D` (Windows), `⌘ D` (macOS), `⌘ D` (IntelliJ IDEA Classic (macOS)), `⌘ D` (macOS System Shortcuts), `Ctrl+D` (XWin), `Ctrl+D` (GNOME), `Ctrl+D` (KDE), `Meta+D` (Emacs), `Ctrl+Shift+D` (Sublime Text), `⌘ ⇧ D` (Sublime Text (macOS)), `Ctrl+D` (NetBeans), `Ctrl+D` (Visual Studio), `⌘ D` (Visual Studio (macOS)), `Ctrl+D` (Eclipse), `Ctrl+D` (Eclipse (macOS))  |
| Remove a line of code |  `Ctrl+Y` (Windows), `⌘ ⌫` (macOS), `⌘ Y` (IntelliJ IDEA Classic (macOS)), `⌘ ⌫` (macOS System Shortcuts), `Ctrl+Y` (XWin), `Ctrl+Y` (GNOME), `Ctrl+Y` (KDE), `Ctrl+Y` (Emacs), `Ctrl+Shift+K` (Sublime Text), `⌃ ⇧ K` (Sublime Text (macOS)), `Ctrl+E` (NetBeans), `Ctrl+L` (Visual Studio), `⌘ ⇧ L` (Visual Studio (macOS)), `Ctrl+D` (Eclipse), `⌘ D` (Eclipse (macOS))  |
| Comment or uncomment a line of code |  `Ctrl+/` (Windows), `⌘ /` (macOS), `⌘ /` (IntelliJ IDEA Classic (macOS)), `⌘ /` (macOS System Shortcuts), `Ctrl+/` (XWin), `Ctrl+/` (GNOME), `Ctrl+/` (KDE), `Alt+;` (Emacs), `Ctrl+/` (Sublime Text), `⌘ /` (Sublime Text (macOS)), `Ctrl+/` (NetBeans), `Ctrl+Alt+/` (Visual Studio), `⌘ ⌥ /` (Visual Studio (macOS)), `Ctrl+/` (Eclipse), `⌘ /` (Eclipse (macOS))  |
| Comment a block of code |  `Ctrl+Shift+/` (Windows), `⌘ ⌥ /` (macOS), `⌃ ⇧ /` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ /` (macOS System Shortcuts), `Ctrl+Shift+/` (XWin), `Ctrl+Shift+/` (GNOME), `Ctrl+Shift+/` (KDE), `Ctrl+Shift+/` (Emacs), `Ctrl+Shift+/` (Sublime Text), `⌘ ⌥ /` (Sublime Text (macOS)), `Ctrl+Shift+/` (NetBeans), `Ctrl+Shift+/` (Visual Studio), `⌘ ⌃ /` (Visual Studio (macOS)), `Ctrl+Shift+/` (Eclipse), `⌘ ⇧ /` (Eclipse (macOS))  |
| Find in the currently opened file |  `Ctrl+F` (Windows), `⌘ F` (macOS), `⌘ F` (IntelliJ IDEA Classic (macOS)), `⌘ F` (macOS System Shortcuts), `Ctrl+F` (XWin), `Ctrl+F` (GNOME), `Ctrl+F` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+F` (Sublime Text), `⌘ F` (Sublime Text (macOS)), `Ctrl+F` (NetBeans), `Ctrl+F` (Visual Studio), `⌘ F` (Visual Studio (macOS)), `Ctrl+F` (Eclipse), `Ctrl+F` (Eclipse (macOS))  |
| Find and replace in the current file |  `Ctrl+R` (Windows), `⌘ R` (macOS), `⌘ R` (IntelliJ IDEA Classic (macOS)), `⌘ R` (macOS System Shortcuts), `Ctrl+R` (XWin), `Ctrl+R` (GNOME), `Ctrl+R` (KDE), `Alt+Shift+5` (Emacs), `Ctrl+H` (Sublime Text), `⌘ ⌥ F` (Sublime Text (macOS)), `Ctrl+H` (NetBeans), `Ctrl+H` (Visual Studio), `⌃ H` (Visual Studio (macOS)), `Ctrl+F` (Eclipse), `Ctrl+R` (Eclipse (macOS))  |
| Next occurrence |  `F3` (Windows), `⌘ G` (macOS), `F3` (IntelliJ IDEA Classic (macOS)), `⌘ G` (macOS System Shortcuts), `F3` (XWin), `F3` (GNOME), `F3` (KDE), `F3` (Emacs), `F3` (Sublime Text), `⌘ G` (Sublime Text (macOS)), `F3` (NetBeans), `F3` (Visual Studio), `F3` (Visual Studio (macOS)), `Ctrl+K` (Eclipse), `⌘ K` (Eclipse (macOS))  |
| Previous occurrence |  `Shift+F3` (Windows), `⌘ ⇧ G` (macOS), `⇧ F3` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ G` (macOS System Shortcuts), `Shift+F3` (XWin), `Shift+F3` (GNOME), `Shift+F3` (KDE), `Shift+F3` (Emacs), `Shift+F3` (Sublime Text), `⌘ ⇧ G` (Sublime Text (macOS)), `Shift+F3` (NetBeans), `Shift+F3` (Visual Studio), `⇧ F3` (Visual Studio (macOS)), `Ctrl+Shift+K` (Eclipse), `⌘ ⇧ K` (Eclipse (macOS))  |
| Navigate between opened tabs |  `Alt+Right` (Windows), `⌘ ⇧ ]` (macOS), `⌃ →` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ →` (macOS System Shortcuts), `Alt+Right` (XWin), `Alt+Right` (GNOME), `Alt+Right` (KDE), `Alt+Right` (Emacs), `Ctrl+Page Down` (Sublime Text), `⌘ ⇧ ]` (Sublime Text (macOS)), `Ctrl+Page Down` (NetBeans), `Alt+Right` (Visual Studio), `⌘ ⇧ ]` (Visual Studio (macOS)), `Ctrl+F6` (Eclipse), `⌘ F6` (Eclipse (macOS)) `Alt+Left` (Windows), `⌘ ⇧ [` (macOS), `⌃ ←` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ ←` (macOS System Shortcuts), `Alt+Left` (XWin), `Alt+Left` (GNOME), `Alt+Left` (KDE), `Alt+Left` (Emacs), `Ctrl+Page Up` (Sublime Text), `⌘ ⇧ [` (Sublime Text (macOS)), `Ctrl+Page Up` (NetBeans), `Alt+Left` (Visual Studio), `⌘ ⇧ [` (Visual Studio (macOS)), `Ctrl+Shift+F6` (Eclipse), `⌘ ⇧ F6` (Eclipse (macOS))  |
| Navigate back/forward |  `Ctrl+Alt+Left` (Windows), `⌘ [` (macOS), `⌘ ⌥ ←` (IntelliJ IDEA Classic (macOS)), `⌘ [` (macOS System Shortcuts), `Ctrl+Alt+Left` (XWin), `Alt+Shift+Left` (GNOME), `Ctrl+Alt+Left` (KDE), `Ctrl+Alt+Left` (Emacs), `Alt+NumPad -` (Sublime Text), `⌃ NumPad -` (Sublime Text (macOS)), `Alt+Left` (NetBeans), `Ctrl+Minus` (Visual Studio), `⌘ Minus` (Visual Studio (macOS)), `Alt+Left` (Eclipse), `⌘ [` (Eclipse (macOS)) `Ctrl+Alt+Right` (Windows), `⌘ ]` (macOS), `⌘ ⌥ →` (IntelliJ IDEA Classic (macOS)), `⌘ ]` (macOS System Shortcuts), `Ctrl+Alt+Right` (XWin), `Alt+Shift+Right` (GNOME), `Ctrl+Alt+Right` (KDE), `Ctrl+Alt+Right` (Emacs), `Alt+Shift+NumPad -` (Sublime Text), `⌃ ⇧ NumPad -` (Sublime Text (macOS)), `Alt+Right` (NetBeans), `Ctrl+Shift+Minus` (Visual Studio), `⌘ ⇧ Minus` (Visual Studio (macOS)), `Alt+Right` (Eclipse), `⌘ ]` (Eclipse (macOS))  |
| Expand or collapse a code block in the editor |  `Ctrl+NumPad +` (Windows), `⌘ NumPad +` (macOS), `⌘ NumPad +` (IntelliJ IDEA Classic (macOS)), `⌘ NumPad +` (macOS System Shortcuts), `Ctrl+NumPad +` (XWin), `Ctrl+NumPad +` (GNOME), `Ctrl+NumPad +` (KDE), `Ctrl+NumPad +` (Emacs), `Ctrl+NumPad +` (Sublime Text), `⌘ NumPad +` (Sublime Text (macOS)), `Ctrl+NumPad +` (NetBeans), `Ctrl+NumPad +` (Visual Studio), `⌘ NumPad +` (Visual Studio (macOS)), `Ctrl+Shift+NumPad *` (Eclipse), `⌘ ⇧ NumPad *` (Eclipse (macOS)) `Ctrl+NumPad -` (Windows), `⌘ NumPad -` (macOS), `⌘ NumPad -` (IntelliJ IDEA Classic (macOS)), `⌘ NumPad -` (macOS System Shortcuts), `Ctrl+NumPad -` (XWin), `Ctrl+NumPad -` (GNOME), `Ctrl+NumPad -` (KDE), `Ctrl+NumPad -` (Emacs), `Ctrl+NumPad -` (Sublime Text), `⌘ NumPad -` (Sublime Text (macOS)), `Ctrl+NumPad -` (NetBeans), `Ctrl+NumPad -` (Visual Studio), `⌘ NumPad -` (Visual Studio (macOS)), `Ctrl+Shift+NumPad /` (Eclipse), `⌘ ⇧ NumPad /` (Eclipse (macOS))  |
| Generate |  `Alt+Insert` (Windows), `⌥ Insert` (macOS), `⌥ Insert` (IntelliJ IDEA Classic (macOS)), `⌥ Insert` (macOS System Shortcuts), `Alt+Insert` (XWin), `Alt+Insert` (GNOME), `Alt+Insert` (KDE), `Alt+Insert` (Emacs), `Alt+Insert` (Sublime Text), `⌥ Insert` (Sublime Text (macOS)), `Alt+Insert` (NetBeans), `Alt+Insert` (Visual Studio), `⌥ Insert` (Visual Studio (macOS)), `Alt+Insert` (Eclipse), `⌥ Insert` (Eclipse (macOS))  |
| Surround with |  `Ctrl+Alt+T` (Windows), `⌘ ⌥ T` (macOS), `⌘ ⌥ T` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ T` (macOS System Shortcuts), `Ctrl+Alt+Shift+B` (XWin), `Ctrl+Alt+Shift+B` (GNOME), `Ctrl+Alt+Shift+B` (KDE), `Ctrl+Alt+T` (Emacs), `Ctrl+Alt+T` (Sublime Text), `⌘ ⌥ T` (Sublime Text (macOS)), `Ctrl+Alt+T` (NetBeans), `Ctrl+Alt+T` (Visual Studio), `Ctrl+Alt+T` (Visual Studio (macOS)), `Alt+Shift+Z` (Eclipse), `⌘ ⌥ Z` (Eclipse (macOS))  |
| Highlight usages of a symbol |  `Ctrl+F7` (Windows), `⌘ F7` (macOS), `⌘ F7` (IntelliJ IDEA Classic (macOS)), `⌃ ⇧ U` (macOS System Shortcuts), `Ctrl+F7` (XWin), `Ctrl+F7` (GNOME), `Ctrl+7` (KDE), `Ctrl+F7` (Emacs), `Ctrl+F7` (Sublime Text), `⌘ F7` (Sublime Text (macOS)), `Ctrl+F7` (NetBeans), `Alt+Shift+F11` (Visual Studio), `⌥ ⇧ F11` (Visual Studio (macOS)), `Ctrl+Shift+G` (Eclipse), `⌘ ⇧ U` (Eclipse (macOS))  |

To expand a selection based on grammar, press `Ctrl+W` (Windows), `⌥ ↑` (macOS), `⌘ W` (IntelliJ IDEA Classic (macOS)), `⌥ ↑` (macOS System Shortcuts), `Ctrl+W` (XWin), `Ctrl+W` (GNOME), `Ctrl+W` (KDE), `Ctrl+Alt+W` (Emacs), `Ctrl+Shift+Space` (Sublime Text), `⌘ ⇧ A` (Sublime Text (macOS)), `Alt+Shift+.` (NetBeans), `Alt+Shift+=` (Visual Studio), `⌘ ⌥ →` (Visual Studio (macOS)), `Alt+Shift+Up` (Eclipse), `⌃ ⇧ ↑` (Eclipse (macOS)). To shrink it, press `Ctrl+Shift+W` (Windows), `⌥ ↓` (macOS), `⌘ ⇧ W` (IntelliJ IDEA Classic (macOS)), `⌥ ↓` (macOS System Shortcuts), `Ctrl+Shift+W` (XWin), `Ctrl+Shift+W` (GNOME), `Ctrl+Shift+W` (KDE), `Ctrl+Shift+W` (Emacs), `Ctrl+Shift+W` (Sublime Text), `Ctrl+Shift+W` (Sublime Text (macOS)), `Alt+Shift+Comma` (NetBeans), `Alt+Shift+Minus` (Visual Studio), `⌘ ⌥ ←` (Visual Studio (macOS)), `Alt+Shift+Down` (Eclipse), `⌃ ⇧ ↓` (Eclipse (macOS)).

IntelliJ IDEA can select more than one piece of code at a time. You can select next occurrence via `Alt+J` (Windows), `⌃ G` (macOS), `⌃ G` (IntelliJ IDEA Classic (macOS)), `⌃ G` (macOS System Shortcuts), `Alt+J` (XWin), `Alt+J` (GNOME), `Alt+J` (KDE), `Alt+J` (Emacs), `Ctrl+D` (Sublime Text), `⌘ D` (Sublime Text (macOS)), `Alt+J` (NetBeans), `Alt+Shift+.` (Visual Studio), `⌥ ⇧ .` (Visual Studio (macOS)), `Alt+Y` (Eclipse), `⌃ G` (Eclipse (macOS)) and deselect by pressing `Alt+Shift+J` (Windows), `⌃ ⇧ G` (macOS), `⌃ ⇧ G` (IntelliJ IDEA Classic (macOS)), `⌃ ⇧ G` (macOS System Shortcuts), `Alt+Shift+J` (XWin), `Alt+Shift+J` (GNOME), `Alt+Shift+J` (KDE), `Alt+Shift+J` (Emacs), `Alt+Shift+J` (Sublime Text), `⌃ ⇧ G` (Sublime Text (macOS)), `Alt+Shift+J` (NetBeans), `Alt+Shift+Comma` (Visual Studio), `⌥ ⇧ Comma` (Visual Studio (macOS)), `Alt+Shift+Y` (Eclipse), `⌃ ⇧ G` (Eclipse (macOS)).   You can even select all occurrences at once, by pressing `Ctrl+Alt+Shift+J` (Windows), `⌘ ⌃ G` (macOS), `⌘ ⌃ G` (IntelliJ IDEA Classic (macOS)), `⌘ ⌃ G` (macOS System Shortcuts), `Ctrl+Alt+Shift+J` (XWin), `Ctrl+Alt+Shift+J` (GNOME), `Ctrl+Alt+Shift+J` (KDE), `Ctrl+Alt+Shift+J` (Emacs), `Alt+F3` (Sublime Text), `⌘ ⌃ G` (Sublime Text (macOS)), `Ctrl+Alt+Shift+J` (NetBeans), `Alt+Shift+;` (Visual Studio), `⌥ ⇧ ;` (Visual Studio (macOS)), `Ctrl+Alt+Y` (Eclipse), `⌘ ⌃ G` (Eclipse (macOS)).

For more information, refer to [Editor basics](using-code-editor.html).

With IntelliJ IDEA you don't need to save code changes every time since you can undo refactorings and revert changes from [Local
History](local-history.html).

## Groovy code style and formatting

IntelliJ IDEA automatically applies a code style you've configured in the [Groovy code style settings](code-style-groovy.html) as you edit.

![Groovy code style settings](https://resources.jetbrains.com.cn/help/img/idea/2026.2/groovy_code_style_settings.png)

Check the following formatting shortcuts:

| Action | Shortcut |
| --- | --- |
| Reformat code |  `Ctrl+Alt+L` (Windows), `⌘ ⌥ L` (macOS), `⌘ ⌥ L` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ L` (macOS System Shortcuts), `Ctrl+Alt+L` (XWin), `Ctrl+Alt+L` (GNOME), `Alt+Shift+L` (KDE), `Ctrl+Alt+L` (Emacs), `Ctrl+Alt+L` (Sublime Text), `⌘ ⌥ L` (Sublime Text (macOS)), `Alt+Shift+F` (NetBeans), `Ctrl+Alt+Enter` (Visual Studio), `⌘ ⌥ ⏎` (Visual Studio (macOS)), `Ctrl+Alt+L` (Eclipse), `⌘ ⇧ F` (Eclipse (macOS))  |
| Auto-indent lines |  `Ctrl+Alt+I` (Windows), `⌃ ⌥ I` (macOS), `⌘ ⌥ I` (IntelliJ IDEA Classic (macOS)), `⌃ ⌥ I` (macOS System Shortcuts), `Ctrl+Alt+I` (XWin), `Ctrl+Alt+I` (GNOME), `Ctrl+Alt+I` (KDE), `Ctrl+Alt+I` (Emacs), `Ctrl+Alt+I` (Sublime Text), `⌃ ⌥ I` (Sublime Text (macOS)), `Ctrl+Alt+I` (NetBeans), `Ctrl+Alt+I` (Visual Studio), `⌃ ⌥ I` (Visual Studio (macOS)), `Ctrl+I` (Eclipse), `⌘ I` (Eclipse (macOS))  |
| Optimize imports |  `Ctrl+Alt+O` (Windows), `⌃ ⌥ O` (macOS), `⌘ ⌥ O` (IntelliJ IDEA Classic (macOS)), `⌃ ⌥ O` (macOS System Shortcuts), `Ctrl+Alt+O` (XWin), `Ctrl+Alt+O` (GNOME), `Ctrl+Alt+O` (KDE), `Ctrl+Alt+O` (Emacs), `Ctrl+Alt+O` (Sublime Text), `⌃ ⌥ O` (Sublime Text (macOS)), `Ctrl+Shift+I` (NetBeans), `Ctrl+R, G` (Visual Studio), `⌃ ⌥ O` (Visual Studio (macOS)), `Ctrl+Alt+O` (Eclipse), `⌘ ⇧ O` (Eclipse (macOS))  |

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 information, refer to [Reformatting Source Code](reformat-and-rearrange-code.html).

## See also

### External Links

[Groovy documentation](http://www.groovy-lang.org/single-page-documentation.html)

