Skip to content

Instantly share code, notes, and snippets.

@zengxs
Created April 30, 2021 09:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zengxs/2738682012e8c03f738b7fb191ae3b2f to your computer and use it in GitHub Desktop.
Save zengxs/2738682012e8c03f738b7fb191ae3b2f to your computer and use it in GitHub Desktop.
%YAML 1.2
---
# https://www.sublimetext.com/docs/3/syntax.html
name: Nim
file_extensions: [nim, nims]
scope: source.nim
contexts:
main:
- include: comments
comments:
# discard triple string literal comment
- match: '(discard)[ \t]+(""")'
captures:
1: keyword.other.nim
2: punctuation.definition.string.begin.nim
push:
- meta_scope: comment.line.number-sign.comment.nim
- include: comment-note
- match: '"""'
scope: punctuation.definition.string.end.nim
pop: true
# multiline documentation comment
- match: '\#\#\['
scope: punctuation.definition.documentation-comment.begin.nim
push:
- meta_scope: comment.line.number-sign.documentation-comment.nim
- include: comment-note
- match: '\]\#\#'
scope: punctuation.definition.documentation-comment.end.nim
pop: true
# multiline regular comment
- match: '\#\['
scope: punctuation.definition.comment.begin.nim
push:
- meta_scope: comment.line.number-sign.comment.nim
- include: comment-note
- match: '\]\#'
scope: punctuation.definition.comment.end.nim
pop: true
# documentation comment
- match: '\#\#'
scope: punctuation.definition.documentation-comment.nim
push:
- meta_scope: comment.line.number-sign.documentation-comment.nim
- include: comment-note
- match: '\n'
pop: true
# regular comment
- match: '\#'
scope: punctuation.definition.comment.nim
push:
- meta_scope: comment.line.number-sign.comment.nim
- include: comment-note
- match: '\n'
pop: true
# highlight TODO, NOTE, ... in comments
comment-note:
- match: '(?i)\b(?:note|todo|fixme|bug)\b'
scope: invalid.illegal.TODO.nim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment