# autocomplete

### Settings

| Name      | Default value       | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| --------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `trigger` | `''` (empty string) | <p>The character(s) that should trigger the autocomplete menu,</p><p>If <code>trigger</code> is an empty string (default), autocomplete will be disabled.</p>                                                                                                                                                                                                                                                                                                             |
| `format`  | `"citekey"`         | <p>The format in which the item's citekey should be inserted.</p><p>Should be one of :</p><p><code>"citekey"</code> (default)</p><p><code>"citation"</code></p><p><code>"tag"</code></p><p><code>"pageref"</code></p><p><code>"popover"</code></p>                                                                                                                                                                                                                        |
| `display` | `"citekey"`         | <p>The text that will be displayed in the inline menu.</p><p>Should be either <code>"citekey"</code> (default) or <code>"zettlr"</code> (authors-year-title string)</p><p></p><p>Note : the query will be matched against what is displayed in the menu. This means that, with <code>display: "citekey"</code>, the query will be matched against the citekey ; with <code>display: "zettlr"</code>, the query will be matched against the authors-year-title string.</p> |

### How to enable autocomplete

The autocomplete feature is disabled by default, unless a trigger is defined by the user.

To setup autocomplete, define the `autocomplete` property **inside of your existing zoteroRoam\_settings object** :

```javascript
// Example : using the @ character as trigger, with 'citekey' as format & display

// DO NOT define the zoteroRoam_settings object again
// Instead, modify your existing zoteroRoam_settings object

zoteroRoam_settings = {
    dataRequests: {
        apikey: 'XXXXXXXXXXXXXXXX',
        dataURI: 'users/1234567/items',
        params: 'limit=100'
    },
    autocomplete: {
        trigger: '@', // Show autocomplete menu when typing @
        format: 'citekey', // Insert the item as @citekey
        display: 'citekey' // Show autocomplete menu items as citekeys
    }
}
```

### `display: "zettlr"`

![An example where display has been set to "zettlr"](/files/-MXXrpRC8prb4c53tLEj)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://alix-lahuec.gitbook.io/zotero-roam/v0.6/customization/other/autocomplete.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
