Skip to content

Instantly share code, notes, and snippets.

@diek
Last active September 18, 2025 22:02
Show Gist options
  • Select an option

  • Save diek/205d7f5b668ed41d3b7756b3f8115b85 to your computer and use it in GitHub Desktop.

Select an option

Save diek/205d7f5b668ed41d3b7756b3f8115b85 to your computer and use it in GitHub Desktop.
YAML Definition - Sublime Text
%YAML 1.2
---
name: YAML (Improved)
file_extensions:
- yml
- yaml
scope: source.yaml
contexts:
main:
# Comments (line-start or inline)
- match: '#.*$'
scope: comment.line.number-sign.yaml
# Boolean & null constants (only when the value is exactly the boolean)
- match: ':\s*(true|false|null|yes|no|on|off)\s*$'
scope: constant.language.boolean.yaml
# Numbers (int, float, hex, scientific)
- match: '\b(0[xX][0-9A-Fa-f]+|\d+(\.\d+)?([eE][+-]?\d+)?)\b'
scope: constant.numeric.yaml
# Document start/end markers
- match: '([-]{3}|[.]{3})'
scope: punctuation.definition.document.yaml
# Anchors (&foo) and aliases (*foo)
- match: '(&\w+)'
scope: entity.name.anchor.yaml
- match: '(\*\w+)'
scope: variable.other.alias.yaml
# Keys
- match: '(\w+):'
captures:
1: entity.name.tag.yaml
# Include scalars (quoted strings etc.)
- include: scalars
# Embedded shell blocks
- match: '^\s*(script|command|run):\s*\|'
push:
- meta_scope: source.yaml.embedded.bash
- include: scope:source.shell
- match: '^(?=\S)'
pop: true
scalars:
- match: |
"([^"\\]|\\.)*"
scope: string.quoted.double.yaml
- match: |
'([^'\\]|\\.)*'
scope: string.quoted.single.yaml
@diek
Copy link
Author

diek commented Sep 18, 2025

A much better syntax highlighter for SBT yaml files

@diek
Copy link
Author

diek commented Sep 18, 2025

Edit needed to differentiate text from comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment