%YAML 1.2
---
name: Gitignore
file_extensions:
- gitignore
- dockerignore
- npmignore
- hgignore
scope: source.gitignore
contexts:
main:
- include: comments
- include: negation
- include: patterns
comments:
- match: '^#.*$'
scope: comment.line.number-sign.gitignore
negation:
- match: '^(!)(.*)'
captures:
1: keyword.operator.negation.gitignore
2: string.unquoted.pattern.negated.gitignore
patterns:
- match: '^(.+)(/)$'
captures:
1: string.unquoted.pattern.gitignore
2: punctuation.separator.directory.gitignore
- match: '^[^#!\s].*$'
scope: string.unquoted.pattern.gitignore
push:
- match: '\*\*'
scope: keyword.operator.glob.doublestar.gitignore
- match: '\*'
scope: keyword.operator.glob.star.gitignore
- match: '\?'
scope: keyword.operator.glob.question.gitignore
- match: '\[([^\]]+)\]'
scope: keyword.operator.glob.bracket.gitignore
- match: '$'
pop: true