Skip to content
A comment preceded by # is ignored during YAML processing.

YAML functions

The YAML button on the lower toolbar shows a dropdown menu with options that involve YAML processing:

  • Sort matches from the current file
  • Edit match sort settings
  • Add word triggers to all non-regex matches in the current file
  • Add case propagation to all non-regex matches in the current file
  • Reorder top-level keys for all matches in the current file
  • Indent the current file with 2 spaces (standard indentation)
  • Flatten the current file (minimum indentation)

YAML button

There is an additional function that involves YAML processing, which is in the Tools menu. This function generates a report on duplicate triggers in matches from the match files in the active folder.

The sort function generates a sorted copy of matches from the current file.

Match sorting

The copy is displayed in a new editor tab so that the output can be reviewed before use. Sorting is alphanumberic. All matches can be grouped together before sorting or matches can be grouped by match type and then sorted within each type. The preferred order of match types can be configured.

Sorting is Espanso-specific but is liable to the following limitations:

  • A global_vars section below matches will remain below after sorting
  • An imports section below matches will remain below after sorting

Any comment preceded with # that is immediately above a match will be sorted with the preceding match. This is because the sort function processes the matches section on the basis of triggers.

This function will generate a copy of the current file in which a word trigger is added to all matches. The copy is displayed in a new editor tab so that the output can be reviewed before use.

This function will generate a copy of the current file in which case propagation is applied to all matches. The copy is displayed in a new editor tab so that the output can be reviewed before use.

This function will generate a copy of the matches from the current file in which top-level keys are reordered for all matches. The copy is displayed in a new editor tab so that the output can be reviewed before use. Top-level keys include the following:

  • label
  • replace
  • search_terms
  • force_mode
  • propagate_case
  • uppercase_style
  • word or left_word or right_word

The Reorder keys dialog allows you to arrange the keys in any order.

The indent function generates a copy of the current file in which indentation is revised. The copy is displayed in a new editor tab so that the output can be reviewed before use. There are two options:

  • Standard indentation with 2 spaces (this is the usual YAML default)
  • The current file is flattened so that indentation is reduced to a minimum (0 spaces)

Indent file

The copy is displayed in a new editor tab so that the output can be reviewed before use.

It is important to note the following limitations:

  • Layout of multi-line scalars can change during YAML processing
  • Any comment preceded with # will be ignored during indentation and is not included in the output

This function will check all match files in the active folder for YAML parser errors.