Link Search Menu Expand Document

Autocomplete Suggestions

Drafts includes an extensible system to provide drop-down autocomplete suggestions while typing in the editor. Autocomplete includes a global system for creating and inserting text snippets, as well as additional autocomplete suggestions provide by syntax definitions

Table of Contents

  1. Global Autocomplete Suggestions
    1. Using Template Tags
  2. Syntax-Specific Autocomplete Suggestions

Global Autocomplete Suggestions

Global autocomplete is enabled on the “Autocomplete” tab on the Editor Preferences window, access via the Aa button at the lower right of the editor, or via Drafts > Editor Preferences... in the main menu.

editor/autocomplete-global

To use global autocomplete, configure the following values:

  • Enable Global Autocomplete
  • Set a Trigger: The trigger text should be a short, unique text string. When the trigger text is typed in the editor, it will trigger the autocomplete suggestion drop-down to appear. It is recommend this trigger be at least 2 characters. The trigger text itself will be removed when selecting an item from the drop-down. It is recommended you avoid using [[ or << as triggers as they conflict with other autocomplete definitions in syntax files (see below).
  • Process Template Tags: Enable if you intend to use Drafts template tags in suggestions.
  • Setup Autocomplete Suggestions: Create one or more items to appear as suggestions in the drop-down. Each suggestion has two fields:
    • Name: A short, easy to identify label for the item. This value will appear in the drop-down, and will be used to filter the list in the drop-down as you keep typing.
    • Value: The text to be inserted if the item is selected. This can be same as the label, but in many cases will contain additional text. Values can also contain Drafts template tags (details below).

Global autocomplete suggestions sync across all your devices, so you can create and manage suggestions on any of your devices and they will be available everywhere you use Drafts.

Using Template Tags

If the “Process Template Tags” option is enabled, autocomplete item names and values will be passed through the Drafts template engine before use. This allow dynamic insertion of values such as dates/times, location information, and more. For details on available tags, see the Templates article.

Syntax-Specific Autocomplete Suggestions

The built-in Markdown syntaxes provide two additional default autocomplete suggestion triggers:

  • Cross-links: [[ : Allow selection of draft titles to ease creation of [[wiki-style]] cross-links to other drafts
  • Draft insertion: << : Allows selection and insertion of the full text of other drafts at the cursor position.

Custom syntax definitions may include additional autocomplete definitions. Consult syntax development documentation for any installed custom syntaxes for capabilities they may provide.


Download on App Store Download on Mac App Store

© 2012-2022 by Agile Tortoise, Inc.
Drafts is a registered Trademark of Agile Tortoise, Inc.
Privacy | Terms