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. Global Autocomplete Sharing and Examples
  2. Syntax-Specific Autocomplete Suggestions

Global Autocomplete Suggestions

Global autocomplete is enabled on the “Autocomplete” tab on the Editor Settings 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. Triggers must 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: If 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.
  • 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.

Global Autocomplete Sharing and Examples

Autocomplete suggestions can be exported-imported using URL schemes using the Share button in the autocomplete editor. A few example suggestions you can install and use:

  • Date: Short: Inserts current date using the %Y-%m-%d format, like 2022-02-14.
  • Date: Long: Inserts current date using the %A, %B %e, %Y format, like Friday, February 18, 2022.
  • Time: Short: Inserts time only using format %l:%M %p, like 7:33 AM.

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.


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

Mastodon