diff --git a/CHANGELOG.md b/CHANGELOG.md index 9497be48..4354654b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Fix subsections of index not being filled without a `_index.md` - Fix generated index section not found in `get_section` global function - Fix permalink generation for index page +- Add Nim syntax highlighting ## 0.2.1 (2017-10-17) diff --git a/sublime_syntaxes/Nim.sublime-syntax b/sublime_syntaxes/Nim.sublime-syntax new file mode 100644 index 00000000..d693c3b0 --- /dev/null +++ b/sublime_syntaxes/Nim.sublime-syntax @@ -0,0 +1,257 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: Nim +file_extensions: + - nim + - nims +scope: source.nim +contexts: + main: + - match: '(\#\[\s*(TODO|todo)?)' + comment: A multiline comment. + captures: + 1: punctuation.definition.multi-comment.nim + 2: invalid.illegal.TODO.nim + push: + - meta_scope: comment.line.number-sign.multi-comment.nim + - match: '(.*]\#)' + captures: + 1: punctuation.definition.multi-comment.nim + 2: invalid.illegal.TODO.nim + pop: true + - match: (##\s*(TODO|todo)?).+$\n? + comment: A documentation comment. + scope: comment.line.number-sign.doc-comment.nim + captures: + 1: punctuation.definition.doc-comment.nim + 2: invalid.illegal.TODO.nim + - match: (##\s*)$\n? + comment: An empty documentation comment. + scope: comment.line.number-sign.doc-comment.empty.nim + captures: + 1: punctuation.definition.doc-comment.empty.nim + - match: (#\s*(TODO|todo)?).*$\n? + comment: A regular comment + scope: comment.line.number-sign.comment.nim + captures: + 1: punctuation.definition.comment.nim + 2: invalid.illegal.TODO.nim + - match: '\{\.' + comment: Pragmas + push: + - meta_scope: pragma + - match: '\.?\}' + pop: true + - match: \" + push: + - meta_scope: string.something.nim + - match: \" + pop: true + - match: '([\w\x{80}-\x{10FFFF}]+)' + scope: entity.other.attribute-name.pragma.nim + - match: discard \"\"\" + comment: A discarded triple string literal comment + push: + - meta_scope: comment.line.discarded.nim + - match: \"\"\" + pop: true + - match: '(?|@|\$|~|&|%|!|\?|\^|\.|:|\\)+) + comment: Generic operators for expressions. + scope: keyword.operator.nim + - match: (for)\s+ + comment: in keyword in a 'for' loop + captures: + 1: keyword.control.nim + push: + - meta_scope: meta.forloop.nim + - match: (?=:) + captures: + 1: keyword.control.nim + pop: true + - match: '\ [\w\x{80}-\x{10FFFF},]+\s+(in)\s+' + captures: + 1: keyword.control.nim + - include: scope:source.nim + - match: '((import)\s+[\.|\w|\/]+,?)' + comment: Import syntax + captures: + 2: keyword.control.nim + - match: '(from)\s+[\/\w]+\s+(?=import)' + captures: + 1: keyword.control.nim + - match: (var|let)\s*\( + comment: Destructure syntax + captures: + 1: keyword.other.nim + push: + - match: \) + captures: + 1: keyword.other.nim + pop: true + - match: '((?