Introduction

What are Live Templates and why might you want to use them?

You can type less code with Live Templates because they allow you to use abbreviations to create common code constructs, so you can save your fingers.

IntelliJ IDEA comes with several Live Templates, but you can also create your own which we will do in this tutorial. You can invoke Live Templates with ⌘J (macOS) / Ctrl+J (Windows/Linux):

Live Templates popup

You can scroll through the available live templates and press (macOS) / Enter (Windows/Linux) to select them. However, what if you want to create your own? You can view existing live templates and create your own in your Settings and Preferences with ⌘, (macOS) / Ctrl+Alt+S (Windows/Linux).

We're going to walk through two examples, a basic one and a more complex one in the next two sections of this tutorial.