%YAML 1.2
---
name: Git Commit Message
file_extensions: []
scope: source.git-commit
contexts:
main:
- include: subject-line
- include: comments
- include: diff-stat
- include: body
subject-line:
- match: '^(?!#)'
push:
- meta_scope: markup.heading.subject.git-commit
- match: '$'
pop: true
comments:
- match: '^#'
push:
- meta_scope: comment.line.number-sign.git-commit
- include: comment-keywords
- include: comment-branch
- include: comment-changes
- match: '$'
pop: true
comment-keywords:
- match: '\b(On branch|Your branch|Changes to be committed|Changes not staged for commit|Untracked files|modified|new file|deleted|renamed|copied|Conflicts|Merge branch|Merge remote-tracking branch|Merge tag|Squash commit|interactive rebase in progress)\b'
scope: keyword.other.git-commit
comment-branch:
- match: "(?<='|origin/)([^'\\s]+)"
scope: entity.name.branch.git-commit
comment-changes:
- match: '^\s+(?:modified|new file|deleted|renamed|copied):\s+(.+)$'
captures:
1: string.unquoted.filepath.git-commit
diff-stat:
- match: '^\s*(\S+)\s*\|\s*(\d+)\s*([+-]+)?'
captures:
1: string.unquoted.filepath.git-commit
2: constant.numeric.git-commit
3: markup.inserted.git-commit
body:
- match: '^(?!#).+'
scope: text.plain.git-commit
- match: '^([\w-]+)(:)\s*(.+)$'
captures:
1: keyword.other.trailer.git-commit
2: punctuation.separator.git-commit
3: string.unquoted.git-commit
- match: '(?:^|\s)(#\d+|GH-\d+|[A-Z]+-\d+)(?:\s|$)'
captures:
1: constant.other.reference.git-commit
- match: '\b[0-9a-fA-F]{7,40}\b'
scope: constant.numeric.hash.git-commit