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

YAML functions

YAML button

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
  • Indent the current file with 2 spaces (standard indentation)
  • Flatten the current file (minimum indentation)

YAML button

Sort matches

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

Comment handling

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.

Add word 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.

Add case propagation

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.

Indent file

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