# Macros

Macros, sometimes referred to as snippets, allow you to quickly insert text when you type certain words. You can think of Macros like an in-built text expander.  Type a keyword and pre-defined text is returned.&#x20;

### How to use Macros

It is important to note that there is no UI for Macros, they are instead  defined in config.edn under the `:macros` key.

1. Open your `config.edn` file (search or via settings), and find the `macros:` section.
2. Type the macro name as the first word wrapped in curly braces e.g. the `foo` macro is typed as `{{foo}}`
3. Macros can have arguments configured with dollar variables. For example, the `hello` macro defined as `"Hello $1 and $2!"` has two arguments and is invoked with comma-delimited arguments like `{{hello foo, bar}}`. This results in `Hello foo and bar!`

A few examples are included below:

Define a macro that inserts text at a specific locationCLOJURE1

```
:macros {
    "compare" "This is better than $1 and $2."
    }

```

Define a macro to insert today's date (via a \[\[Dynamic Variable]])CLOJURE1

```
:macros {
    "today" "Today is **<% today %>**"
    }
```
