# Using Live Templates to type less

**URL:** <https://openrndr.discourse.group/t/using-live-templates-to-type-less/348>\
**Category:** Tutorials\
**Created:** [April 27, 2023, 6:00pm UTC](https://openrndr.discourse.group/t/using-live-templates-to-type-less/348 "2023-04-27T18:00:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![abe](https://yyz2.discourse-cdn.com/free1/user_avatar/openrndr.discourse.group/abe/32/700_2.png) [@abe](https://openrndr.discourse.group/u/abe)\
**Post date:** [April 27, 2023, 6:00pm UTC](https://openrndr.discourse.group/t/using-live-templates-to-type-less/348/1 "2023-04-27T18:00:00Z")

</div>

Hi 🙂

Live Templates is an IntelliJ Idea feature that expands short acronyms into full blocks of code.

[This repository](https://github.com/openrndr/openrndr-intellij-settings) includes a collection of them fine tuned for OPENRNDR. [Install instructions here](https://openrndr.discourse.group/t/using-live-templates-to-type-less/348/2).

Example: type `ora[TAB]` and it gets expanded into

```auto
fun main() = application { 
    configure { }
    program {
        extend {
            
        }
    }
}

```

So convenient! Just create a new Kotlin file, type `ora`, press the `TAB` key and you’re rolling 🙂

You can combine them with your own live templates. My settings look like this:

 ![image](https://global.discourse-cdn.com/free1/uploads/openrndr/original/1X/2cffd41441ad830282f758221317a9f091cd74b4.png)

I added things I frequently use, for example `kb` expands into:

```auto
keyboard.keyDown.listen { 
    when(it.key) {
        KEY_ENTER -> 1+1
        KEY_ESCAPE -> application.exit()
    }
}

```

Do you have any templates that make your life easier?

---

<div class="post-metadata">

**Author:** ![abe](https://yyz2.discourse-cdn.com/free1/user_avatar/openrndr.discourse.group/abe/32/700_2.png) [@abe](https://openrndr.discourse.group/u/abe)\
**Post date:** [April 30, 2023, 7:06am UTC](https://openrndr.discourse.group/t/using-live-templates-to-type-less/348/2 "2023-04-30T07:06:43Z")

</div>

A simple approach to install the live templates is to copy its XML code and paste them into the IDE:

1. Right click on [OPENRNDR.xml](https://raw.githubusercontent.com/openrndr/openrndr-intellij-settings/main/templates/OPENRNDR.xml) → Open In New Window
2. On the new window, select all the `<template> ... </template>` blocks (in other words, copy everything except the first and the last lines).
3. Right click on the selected text → Copy
4. In IntelliJ Idea, go to File → Settings → Editor → Live Templates
5. Click on `+` on the right side of the window to create a Template Group called `OPENRNDR`.
6. Click on `OPENRNDR` to select it.
7. Press CTRL+V or Command+V to paste the copied XML templates into the OPENRNDR group.

Now you can use the live templates.

The cool thing about this copy-paste approach is that it makes it easy to share templates on a chat or post them here in the forum. For example here goes one I often use: `dbc` for `drawer.bounds.center`:

```xml
<template name="dbc" value="drawer.bounds.center" description="drawer.bounds.center" toReformat="false" toShortenFQNames="true">
  <context>
    <option name="KOTLIN" value="true" />
  </context>
</template>

```
