# Live Templates

> **TL;DR**
> `File | Settings | Editor | Live Templates` for Windows and Linux
>
>
>
> `IntelliJ IDEA | Settings | Editor | Live Templates` for macOS
>
>
>
> `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)) ![the Settings icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.settings.svg)

Use this page to create, manage, and edit [live templates](using-live-templates.html) .

## Main settings

| Item | Description |
| --- | --- |
| By default expand with |    Specifies the default invocation key for all templates. Individual expansion keys for the particular templates are defined in the [editing area](#templateTextArea).      If the standard expansion keys (`Tab` (Windows), `⇥` (macOS), `⇥` (IntelliJ IDEA Classic (macOS)), `⇥` (macOS System Shortcuts), `Tab` (XWin), `Tab` (GNOME), `Tab` (KDE), `Tab` (Emacs), `Tab` (Sublime Text), `⇥` (Sublime Text (macOS)), `Tab` (NetBeans), `Tab` (Visual Studio), `⇥` (Visual Studio (macOS)), `Tab` (Eclipse), `⇥` (Eclipse (macOS)), `Enter` (Windows), `⏎` (macOS), `⏎` (IntelliJ IDEA Classic (macOS)), `⏎` (macOS System Shortcuts), `Enter` (XWin), `Enter` (GNOME), `Enter` (KDE), `Enter` (Emacs), `Enter` (Sublime Text), `⏎` (Sublime Text (macOS)), `Enter` (NetBeans), `Enter` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (Eclipse), `⏎` (Eclipse (macOS)), or `Space` (Windows), `Space` (macOS), `Space` (IntelliJ IDEA Classic (macOS)), `Space` (macOS System Shortcuts), `Space` (XWin), `Space` (GNOME), `Space` (KDE), `Space` (Emacs), `Space` (Sublime Text), `Space` (Sublime Text (macOS)), `Space` (NetBeans), `Space` (Visual Studio), `Space` (Visual Studio (macOS)), `Space` (Eclipse), `Space` (Eclipse (macOS))) are not desirable, select the Custom option from this list.      When Custom is selected, the Change link appears next to the drop-down, leading you to the [Keymap](settings-keymap.html) page.    |
| Live Templates |    Displays all currently available template abbreviations with their descriptions. The abbreviations are grouped below nodes and sorted alphabetically within each group. To activate a template or an entire group, select the checkbox near the template or the group.      > **Note:** > * Only active templates are displayed in the editor. > > * If a template is active, the editor is sensitive to its abbreviation. Otherwise, the abbreviation is considered a set of characters.    |
|  ![The Add icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.add.svg)  | Add `Alt+Insert` (Windows), `⌘ N` (macOS), `⌃ N` (IntelliJ IDEA Classic (macOS)), `⌘ N` (macOS System Shortcuts), `Alt+Insert` (XWin), `Alt+Insert` (GNOME), `Alt+Insert` (KDE), `Alt+Insert` (Emacs), `Ctrl+N` (Sublime Text), `⌘ N` (Sublime Text (macOS)), `Alt+Insert` (NetBeans), `Ctrl+N` (Visual Studio), `⌘ N` (Visual Studio (macOS)), `Alt+Insert` (Eclipse), `⌘ N` (Eclipse (macOS))  | Adds a new template item to the current group of templates. You can define the template abbreviation, description, text, variables, expansion key, and context in the editing area [below](#templateTextArea). |
|  ![The Remove icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.remove.svg)  | Remove `Delete` (Windows), `⌦` (macOS), `⌦` (IntelliJ IDEA Classic (macOS)), `⌦` (macOS System Shortcuts), `Delete` (XWin), `Delete` (GNOME), `Delete` (KDE), `Delete` (Emacs), `Delete` (Sublime Text), `⌦` (Sublime Text (macOS)), `Delete` (NetBeans), `Delete` (Visual Studio), `⌦` (Visual Studio (macOS)), `Delete` (Eclipse), `⌦` (Eclipse (macOS))  | Removes the selected live template from the list. |
|  ![The Duplicate icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.copy.svg)  | Duplicate | Click this button to create a new template based on the selected template. A new template item is added to the current node, and the fields in the Template Text area show the definition of the selected template.  |
| ![The Restore deleted defaults icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.actions.rollback.svg) | Restore deleted default templates | Click this button to restore the deleted live templates. This button is only enabled when the changes are applied. |

## Context menu of a live template

| Item | Description |
| --- | --- |
| Move | Moves the selected template to a specified group. |
| Change context |    Changes context or contexts where the current template is enabled. When you select this command, a list of supported language contexts is displayed. To make IntelliJ IDEA consider a context-sensitive to the template, select a checkbox next to the context name.      The available context types depend on the enabled plugins.    |
| Copy | Creates a [serialized template XML](sharing-live-templates.html) in the system clipboard.  |
| Paste | Pastes an XML representation of the [copied templates](sharing-live-templates.html) to the selected group of templates.  |
| Restore defaults | This command only appears on the context menus of the modified templates, marked blue. Choose this command to restore the default template settings. |

## Template editing area

> **Tip:**
> The Edit Variables button is enabled only if the template body contains at least one user-defined variable, that is, a variable different from `$END$` or `$SELECTION$`.

The focus is moved to this area in the following cases:

* When you click the Add ![The Add icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.add.svg) or Copy ![The Copy icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.copy.svg) button.

* When you select a live template in the list.

* When you select a fragment of code in the editor and choose `Code | Save as Live Template`.

Use controls of this area to create new [live templates](using-live-templates.html) and edit the settings for the existing ones.

You can navigate through the Template Text Area using the hot keys that are marked in the field labels.

| Item | Description |
| --- | --- |
| Abbreviation |  In this field, specify the template abbreviation. For example, a sequence of characters that identify the template in the editor.  |
| Description | In this field, provide optional description of a template or an example of its usage. |
| Template Text | In this field, type the template body that may contain plain text and variables in the format `$<variable name>$`. If necessary, click Edit Variables and   [configure the variables](null) as required.  To escape a dollar sign `$` in the template text, just duplicate it `$$`.                             |
| Applicable in | This read-only field shows the languages and pieces of code where the editor should be sensitive to the template. Upon pressing `Ctrl+J` (Windows), `⌘ J` (macOS), `⌘ J` (IntelliJ IDEA Classic (macOS)), `⌘ J` (macOS System Shortcuts), `Ctrl+J` (XWin), `Ctrl+J` (GNOME), `Ctrl+J` (KDE), `Ctrl+J` (Emacs), `Ctrl+J` (Sublime Text), `Ctrl+J` (Sublime Text (macOS)), `Ctrl+J` (NetBeans), `Ctrl+K, X` (Visual Studio), `⌘ E, L` (Visual Studio (macOS)), `Ctrl+Alt+Shift+J` (Eclipse), `Ctrl+J` (Eclipse (macOS)) in such context, IntelliJ IDEA displays a list of templates that are valid for this context. |
| Change |     Click this link to modify the set of contexts where the current template is enabled. Upon clicking the link, a list of supported language contexts is displayed. To make IntelliJ IDEA consider a context-sensitive to the template, select a checkbox next to the context name.     The available context types depend on the enabled plugins.    |
| Edit Variables |  Open the [Edit Template Variables](edit-template-variables-dialog.html) dialog, where you can define how IntelliJ IDEA should process template variables upon template expansion.  For more information, refer to [Live template variables](template-variables.html).   |
| Options |    In this area, define the behavior of the editor when a template is expanded.        * Expand with - from this list, choose the key to invoke the template.    * Reformat according to style: select this checkbox to have IntelliJ IDEA automatically reformat the expanded text according to the current style settings, defined on the [Code Style page](settings-code-style.html).    * Use static import if possible: select this checkbox to have IntelliJ IDEA add static import statements instead of inserting `MyUtils.methodName()`.    * Shorten FQ names: select this checkbox to have IntelliJ IDEA truncate fully qualified names in the expanded template and add the corresponding import statements.    |

## How it works

* [Live templates](using-live-templates.html)

* [Create live templates](creating-and-editing-live-templates.html)

* [Live template variables](template-variables.html)

