aboutsummaryrefslogtreecommitdiff
path: root/runtime/syntax
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2024-11-15 08:40:22 +0100
committerChristian Clason <ch.clason+github@icloud.com>2024-11-15 09:07:37 +0100
commitf0fd9acc4bcc4233a4bc661f23626abe496a3cee (patch)
tree7af551a4332ee569d99b948df4e405c3fbfd4710 /runtime/syntax
parent2024c10d74cea760ff9e4ac8208cc4c9c176f4d3 (diff)
downloadrneovim-f0fd9acc4bcc4233a4bc661f23626abe496a3cee.tar.gz
rneovim-f0fd9acc4bcc4233a4bc661f23626abe496a3cee.tar.bz2
rneovim-f0fd9acc4bcc4233a4bc661f23626abe496a3cee.zip
vim-patch:9.1.0865: filetype: org files are not recognized
Problem: filetype: org files are not recognized Solution: detect '*.org' files as 'org' filetype, include filetype and syntax plugin (Luca Saccarola) closes: vim/vim#16054 https://github.com/vim/vim/commit/0684800c853ee5bd6e6736389b1a6ebe6a16a741 Co-authored-by: Luca Saccarola <github.e41mv@aleeas.com>
Diffstat (limited to 'runtime/syntax')
-rw-r--r--runtime/syntax/org.vim71
1 files changed, 71 insertions, 0 deletions
diff --git a/runtime/syntax/org.vim b/runtime/syntax/org.vim
new file mode 100644
index 0000000000..89c8de31b4
--- /dev/null
+++ b/runtime/syntax/org.vim
@@ -0,0 +1,71 @@
+" Vim syntax file
+" Language: Org
+" Maintainer: Luca Saccarola <github.e41mv@aleeas.com>
+" Last Change: 2024 Nov 14
+"
+" Reference Specification: Org mode manual
+" GNU Info: `$ info Org`
+" Web: <https://orgmode.org/manual/index.html>
+
+" Quit when a (custom) syntax file was already loaded
+if exists("b:current_syntax")
+ finish
+endif
+let b:current_syntax = 'org'
+
+syn case ignore
+
+" Bold
+syn region orgBold matchgroup=orgBoldDelimiter start="\(^\|[- '"({\]]\)\@<=\*\ze[^ ]" end="^\@!\*\([^\k\*]\|$\)\@=" keepend
+hi def link orgBold markdownBold
+hi def link orgBoldDelimiter orgBold
+
+" Italic
+syn region orgItalic matchgroup=orgItalicDelimiter start="\(^\|[- '"({\]]\)\@<=\/\ze[^ ]" end="^\@!\/\([^\k\/]\|$\)\@=" keepend
+hi def link orgItalic markdownItalic
+hi def link orgItalicDelimiter orgItalic
+
+" Strikethrogh
+syn region orgStrikethrough matchgroup=orgStrikethroughDelimiter start="\(^\|[ '"({\]]\)\@<=+\ze[^ ]" end="^\@!+\([^\k+]\|$\)\@=" keepend
+hi def link orgStrikethrough markdownStrike
+hi def link orgStrikethroughDelimiter orgStrikethrough
+
+" Underline
+syn region orgUnderline matchgroup=orgUnderlineDelimiter start="\(^\|[- '"({\]]\)\@<=_\ze[^ ]" end="^\@!_\([^\k_]\|$\)\@=" keepend
+
+" Headlines
+syn match orgHeadline "^\*\+\s\+.*$" keepend
+hi def link orgHeadline Title
+
+" Line Comment
+syn match orgLineComment /^\s*#\s\+.*$/ keepend
+hi def link orgLineComment Comment
+
+" Block Comment
+syn region orgBlockComment matchgroup=orgBlockCommentDelimiter start="\c^\s*#+BEGIN_COMMENT" end="\c^\s*#+END_COMMENT" keepend
+hi def link orgBlockComment Comment
+hi def link orgBlockCommentDelimiter Comment
+
+" Lists
+syn match orgUnorderedListMarker "^\s*[-+]\s\+" keepend
+hi def link orgUnorderedListMarker markdownOrderedListMarker
+syn match orgOrderedListMarker "^\s*\(\d\|\a\)\+[.)]\s\+" keepend
+hi def link orgOrderedListMarker markdownOrderedListMarker
+"
+" Verbatim
+syn region orgVerbatimInline matchgroup=orgVerbatimInlineDelimiter start="\(^\|[- '"({\]]\)\@<==\ze[^ ]" end="^\@!=\([^\k=]\|$\)\@=" keepend
+hi def link orgVerbatimInline markdownCodeBlock
+hi def link orgVerbatimInlineDelimiter orgVerbatimInline
+syn region orgVerbatimBlock matchgroup=orgVerbatimBlockDelimiter start="\c^\s*#+BEGIN_.*" end="\c^\s*#+END_.*" keepend
+hi def link orgVerbatimBlock orgCode
+hi def link orgVerbatimBlockDelimiter orgVerbatimBlock
+
+" Code
+syn region orgCodeInline matchgroup=orgCodeInlineDelimiter start="\(^\|[- '"({\]]\)\@<=\~\ze[^ ]" end="^\@!\~\([^\k\~]\|$\)\@=" keepend
+highlight def link orgCodeInline markdownCodeBlock
+highlight def link orgCodeInlineDelimiter orgCodeInline
+syn region orgCodeBlock matchgroup=orgCodeBlockDelimiter start="\c^\s*#+BEGIN_SRC.*" end="\c^\s*#+END_SRC" keepend
+highlight def link orgCodeBlock markdownCodeBlock
+highlight def link orgCodeBlockDelimiter orgCodeBlock
+
+" vim: ts=8 sts=2 sw=2 et