Skip to content

Instantly share code, notes, and snippets.

@openly-retro
Last active January 7, 2026 16:21
Show Gist options
  • Select an option

  • Save openly-retro/54a2bfc80f3568ebebd2a686b82df620 to your computer and use it in GitHub Desktop.

Select an option

Save openly-retro/54a2bfc80f3568ebebd2a686b82df620 to your computer and use it in GitHub Desktop.
Sublime Syntax for Stellaris (Clausewitz) script (paradox interactive)
%YAML 1.2
---
# See http://www.sublimetext.com/docs/syntax.html
# This syntax file describes how to parse clausewitz files
# so that Sublime Text can identify scopes
# Once scopes are identified, color schemes can be applied in the editor
# https://www.sublimetext.com/docs/syntax.html
# https://www.sublimetext.com/docs/scope_naming.html
file_extensions: [txt, cwz]
name: Stellaris (Clausewitz)
scope: source.stellaris
variables:
ident: '\b\@([A-Za-z_][A-Za-z_0-9]*)\b'
contexts:
main:
# Strings begin and end with quotes, and use backslashes as an escape
# character
- match: '"'
scope: punctuation.definition.string.begin.stellaris
push: double_quoted_string
# Comments begin with a '#' and finish at the end of the line
- match: '#'
scope: punctuation.definition.comment.stellaris
push: line_comment
# Keywords are if, else for and while.
# Note that blackslashes don't need to be escaped within single quoted
# strings in YAML. When using single quoted strings, only single quotes
# need to be escaped: this is done by using two single quotes next to each
# other.
- match: '\b(if|else_if|else|while)\b'
scope: keyword.control.stellaris
- match: '\b(and|AND|or|OR|not|NOT|nand|NAND|nor|NOR)\b'
scope: keyword.operator.word
- match: '\b(>=|<=|>|<)\b'
scope: keyword.operator.logical
# Numbers
- match: '\b(-)?[0-9.]+\b'
scope: constant.numeric.stellaris
- match: \{
scope: punctuation.section.block.start.c++
- match: \}
scope: punctuation.section.block.end.c++
# scope keywords
- match: '\b(alliance|archaeological_site|army_leader|assembling_species|associated_federation|astral_rift|attacker|aura_owner|background_planet|branch_office_owner|built_species|capital_scope|capital_star|contact_country|controller|creator|declining_species|defender|design|envoy_location_country|excavator_fleet|explorer|federation|federation_leader|fleet|founder_species|from|fromfrom|fromfromfrom|fromfromfromfrom|galactic_custodian|galactic_emperor|growing_species|heir|home_planet|instigator|last_added_deposit|last_created_ambient_object|last_created_army|last_created_cosmic_storm|last_created_cosmic_storm_influence_field|last_created_country|last_created_design|last_created_fleet|last_created_leader|last_created_pop_faction|last_created_ship|last_created_species|last_created_system|leader|lock_country|mining_station|no_scope|observation_outpost|observation_outpost_owner|orbit|orbital_defence|orbital_station|overlord|owner|owner_main_species|owner_or_space_owner|owner_species|planet|planet_owner|pop_faction|prev|prevprev|prevprevprev|prevprevprevprev|research_station|reverse_first_contact|root|ruler|sector|sector_capital|ship_growth_stage|solar_system|space_owner|spawner_planet|species|spynetwork|star|starbase|storm_influence_field|system_star|target|target_system|this|unhappiest_pop)\b'
scope: entity.name.interface
# values (right-hand side of `=`)
# - match: '(?:=\s)(\w*)'
# captures:
# 1: variable.parameter
# static vars
- match: '(\@\w*)'
captures:
1: entity.name.constant
# beginning of a block definition
- match: '^(\w*)'
captures:
1: entity.name.function
# yes/no
- match: '\b(yes|no)\b'
scope: storage.type.bool
double_quoted_string:
- meta_scope: string.quoted.double.stellaris
- match: '\\.'
scope: constant.character.escape.stellaris
- match: '"'
scope: punctuation.definition.string.end.stellaris
pop: true
line_comment:
- meta_scope: comment.line.stellaris
- match: $
pop: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment