Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Org mode syntax #575

Merged
merged 1 commit into from
May 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,6 @@
[submodule "assets/syntaxes/sublime-fish"]
path = assets/syntaxes/sublime-fish
url = https://github.com/Phidica/sublime-fish.git
[submodule "assets/syntaxes/Org mode"]
path = assets/syntaxes/Org mode
url = https://github.com/jezcope/Org.tmbundle.git
1 change: 1 addition & 0 deletions assets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ The following files have been manually modified after converting from a `.tmLang

* `Dart.sublime-syntax` => removed `#regex.dart` include.
* `INI.sublime-syntax` => added `.hgrc`, `hgrc`, and `desktop` file types.
* `Org mode.sublime-syntax` => removed `task` file type.

### Non-submodule additions

Expand Down
1 change: 1 addition & 0 deletions assets/syntaxes/Org mode
Submodule Org mode added at 4976d8
219 changes: 219 additions & 0 deletions assets/syntaxes/Org mode.sublime-syntax
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: orgmode
file_extensions:
- org
scope: text.orgmode
contexts:
main:
- match: |-
(?x)
^(\*+) # leading stars
\s*([A-Z_]{2,})? # todo keywords
\s*(\[\#[A-Ca-c]\])? # priority
\s*(?=\s+[A-Za-z0-9]+) # expected heading text
comment: Outline headings
captures:
1: punctuation.definition.heading.orgmode
2: keyword.other.todo.orgmode
3: constant.other.priority.orgmode
push:
- meta_scope: markup.heading.orgmode
- meta_content_scope: entity.name.section.orgmode
- match: (?=\s*$\n?)
pop: true
- include: heading-inline
- match: "^-{5,}$"
scope: meta.separator.orgmode
- match: '^\s*([-+]|\s+\*)\s+(.*?)\s+::'
captures:
1: keyword.operator.list.orgmode
2: markup.bold.definition.orgmode
push:
- meta_scope: meta.list.definition.orgmode
- match: $
pop: true
- include: inline
- match: '^\s*?([-+]|\s+\*|\d+[).])'
captures:
1: keyword.operator.list.orgmode
push:
- meta_scope: meta.list.plain.orgmode
- match: $
pop: true
- include: list-inline
- match: (?i)^#\+(BEGIN_(QUOTE|VERSE|CENTER))$
captures:
1: keyword.control.block.orgmode
push:
- meta_scope: markup.quote.orgmode
- match: (?i)^#\+(END_\2)$
captures:
1: keyword.control.block.orgmode
pop: true
- match: "^#[^+].*$"
scope: comment.line.number-sign.orgmode
- match: ^:(PROPERTIES):$
captures:
1: keyword.control.drawer.orgmode
push:
- meta_scope: meta.drawer.properties.orgmode
- match: ^:(END):$
captures:
1: keyword.control.drawer.orgmode
pop: true
- include: properties
- match: ^:(.+):$
captures:
1: keyword.control.drawer.orgmode
push:
- meta_scope: meta.drawer.other.orgmode
- match: ^:(END):$
captures:
1: keyword.control.drawer.orgmode
pop: true
- match: (?i)#\+(BEGIN_LaTeX)$
captures:
1: keyword.control.block.orgmode
push:
- meta_scope: meta.block.latex.orgmode
- match: (?i)#\+(END_LaTeX)$
captures:
1: keyword.control.block.orgmode
pop: true
- include: scope:text.tex.latex
- match: (?i)#\+(BEGIN_HTML)$
captures:
1: keyword.control.block.orgmode
push:
- meta_scope: meta.block.html.orgmode
- match: (?i)#\+(END_HTML)$
captures:
1: keyword.control.block.orgmode
pop: true
- include: scope:text.html.basic
- match: (?i)#\+(BEGIN_SRC)\s+(python)\s*(.*)$
captures:
1: keyword.control.block.orgmode
2: constant.other.language.orgmode
3: string.other.header-args.orgmode
push:
- meta_scope: meta.block.source.python.orgmode
- match: (?i)#\+(END_SRC)$
captures:
1: keyword.control.block.orgmode
pop: true
- include: scope:source.python
- match: (?i)#\+(BEGIN_SRC)\s+(ruby)\s*(.*)$
captures:
1: keyword.control.block.orgmode
2: constant.other.language.orgmode
3: string.other.header-args.orgmode
push:
- meta_scope: meta.block.source.ruby.orgmode
- match: (?i)#\+(END_SRC)$
captures:
1: keyword.control.block.orgmode
pop: true
- include: scope:source.ruby
- match: (?i)#\+(BEGIN_SRC)\s+((?:emacs-)?lisp)\s*(.*)$
captures:
1: keyword.control.block.orgmode
2: constant.other.language.orgmode
3: string.other.header-args.orgmode
push:
- meta_scope: meta.block.source.lisp.orgmode
- match: (?i)#\+(END_SRC)$
captures:
1: keyword.control.block.orgmode
pop: true
- include: scope:source.lisp
- match: (?i)#\+(BEGIN_SRC)\s+(sh)\s*(.*)$
captures:
1: keyword.control.block.orgmode
2: constant.other.language.orgmode
3: string.other.header-args.orgmode
push:
- meta_scope: meta.block.source.shell.orgmode
- match: (?i)#\+(END_SRC)$
captures:
1: keyword.control.block.orgmode
pop: true
- include: scope:source.shell
- match: '(?i)#\+(BEGIN_(SRC|EXAMPLE))(?:\s+([\w-]+)?\s*(.*))?$'
captures:
1: keyword.control.block.orgmode
3: constant.other.language.orgmode
4: string.other.header-args.orgmode
push:
- meta_scope: meta.block.source.other.orgmode
- meta_content_scope: markup.raw.block.orgmode
- match: (?i)#\+(END_\2)$
captures:
1: keyword.control.block.orgmode
pop: true
- match: '#\+(OPTIONS):'
captures:
1: keyword.control.pragma.orgmode
push:
- meta_scope: meta.pragma.options.orgmode
- match: $
pop: true
- match: '([^\s]+):([^\s]+)'
scope: meta.option.orgmode
captures:
1: variable.parameter.option.orgmode
2: string.other.option.orgmode
- match: '#\+(CALL):\s+[A-Za-z-]+(?:\[([^\]]*)\])?\(?'
captures:
1: keyword.control.pragma.orgmode
2: string.other.header-args.orgmode
push:
- meta_scope: meta.pragma.call.orgmode
- match: '\)?([^)]*)$'
captures:
1: string.other.header-args.orgmode
pop: true
- match: (\w+)=
scope: meta.assignment.orgmode
captures:
1: variable.parameter.header-args.orgmode
- match: '^#\+([a-zA-Z_-]+): ?(.*)$'
scope: meta.pragma.orgmode
captures:
1: keyword.control.pragma.orgmode
2: string.unquoted.pragma.orgmode
- include: inline
heading-inline:
- match: ':([^:^\s]*)(?=:)'
scope: meta.keyword.orgmode
captures:
1: string.quoted.keyword.orgmode
- include: inline
inline:
- match: '(?<=^|[.,:;\s])/[^/]+/(?=$|[.,:;\s])'
scope: markup.italic.orgmode
- match: '(?<=^|[.,:;\s])\*[^*]+\*(?=$|[.,:;\s])'
scope: markup.bold.orgmode
- match: '(?<=^|[.,:;\s])_[^_]+_(?=$|[.,:;\s])'
scope: markup.underline.orgmode
- match: '(?<=^|[.,:;\s])([~=]).+?\1(?=$|[.,:;\s])'
scope: markup.raw.inline.orgmode
- match: '\[(?:\[([^\]]*)\])?\[([^\]]*)\]\]'
scope: meta.link.orgmode
captures:
1: markup.underline.link.orgmode
2: string.other.link.orgmode
- match: (?:http|ftp)s?:\/\/\S+
scope: markup.underline.url.orgmode
list-inline:
- match: '\[[ -X]\]'
scope: keyword.operator.checkbox.orgmode
- include: inline
properties:
- match: '^:([A-Za-z_]+):\s(.*)$'
scope: meta.property.orgmode
captures:
1: keyword.control.property.orgmode
2: string.unquoted.propval.orgmode