mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-08 03:23:51 -05:00
Add org mode, close #706
This commit is contained in:
@@ -7,7 +7,7 @@ A collection of language packs for Vim.
|
||||
> One to rule them all, one to find them, one to bring them all and in the darkness bind them.
|
||||
|
||||
- It **won't affect your startup time**, as scripts are loaded only on demand\*.
|
||||
- It **installs and updates 120+ times faster** than the <!--Package Count-->606<!--/Package Count--> packages it consists of.
|
||||
- It **installs and updates 120+ times faster** than the <!--Package Count-->607<!--/Package Count--> packages it consists of.
|
||||
- It is also more secure (scripts loaded for every filetype are generated by vim-polyglot)
|
||||
- Best syntax and indentation support (no other features). Hand-selected language packs.
|
||||
- Automatically detects indentation (includes performance-optimized version of [vim-sleuth](https://github.com/tpope/vim-sleuth), can be disabled)
|
||||
@@ -143,6 +143,7 @@ On top of all language packs from [vim repository](https://github.com/vim/vim/tr
|
||||
- [odin](https://github.com/Tetralux/odin.vim) (Odin syntax highlighting for odin files)
|
||||
- [opencl](https://github.com/petRUShka/vim-opencl) (OpenCL syntax highlighting for cl and opencl files)
|
||||
- [openscad](https://github.com/sirtaj/vim-openscad) (Syntax highlighting for scad files)
|
||||
- [org](https://github.com/axvr/org.vim) (Syntax highlighting for org files)
|
||||
- [perl](https://github.com/vim-perl/vim-perl) (Perl syntax highlighting for pl, al, cgi, fcgi, perl and 12 more files)
|
||||
- [pest](https://github.com/pest-parser/pest.vim) (Syntax highlighting for pest files)
|
||||
- [pgsql](https://github.com/lifepillar/pgsql.vim) (PLpgSQL syntax highlighting for pgsql files)
|
||||
|
||||
30
autoload/org.vim
Normal file
30
autoload/org.vim
Normal file
@@ -0,0 +1,30 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'org', 'autoload/org.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Helper functions for org.vim
|
||||
"
|
||||
" Maintainer: Alex Vear <av@axvr.io>
|
||||
" License: Vim (see `:help license`)
|
||||
" Location: autoload/org.vim
|
||||
" Website: https://github.com/axvr/org.vim
|
||||
" Last Change: 2020-01-04
|
||||
|
||||
" Fallback chain for options. Buffer local --> Global --> default.
|
||||
function org#option(name, default) abort
|
||||
return get(b:, a:name, get(g:, a:name, a:default))
|
||||
endfunction
|
||||
|
||||
" Emacs-like fold text.
|
||||
function org#fold_text() abort
|
||||
return getline(v:foldstart) . '...'
|
||||
endfunction
|
||||
|
||||
" Check fold depth of a line.
|
||||
function org#fold_expr()
|
||||
let l:depth = match(getline(v:lnum), '\(^\*\+\)\@<=\( .*$\)\@=')
|
||||
if l:depth > 0 && synIDattr(synID(v:lnum, 1, 1), 'name') =~# '\m^o\(rg\|utline\)Heading'
|
||||
return ">" . l:depth
|
||||
endif
|
||||
return "="
|
||||
endfunction
|
||||
@@ -169,6 +169,10 @@ let did_load_filetypes = 1
|
||||
|
||||
" DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'org')
|
||||
au BufNewFile,BufRead *.org setf org
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'mermaid')
|
||||
au BufNewFile,BufRead *.mermaid,*.mm,*.mmd setf mermaid
|
||||
endif
|
||||
|
||||
@@ -388,6 +388,7 @@ let s:globs = {
|
||||
\ 'openscad': '*.scad',
|
||||
\ 'opl': '*.[Oo][Pp][Ll]',
|
||||
\ 'ora': '*.ora',
|
||||
\ 'org': '*.org',
|
||||
\ 'pamconf': '',
|
||||
\ 'pamenv': 'pam_env.conf,.pam_environment',
|
||||
\ 'papp': '*.papp,*.pxml,*.pxsl',
|
||||
|
||||
28
ftplugin/org.vim
Normal file
28
ftplugin/org.vim
Normal file
@@ -0,0 +1,28 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'org', 'ftplugin/org.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim filetype plugin for GNU Emacs' Org mode
|
||||
"
|
||||
" Maintainer: Alex Vear <av@axvr.io>
|
||||
" License: Vim (see `:help license`)
|
||||
" Location: ftplugin/org.vim
|
||||
" Website: https://github.com/axvr/org.vim
|
||||
" Last Change: 2020-01-04
|
||||
"
|
||||
" Reference Specification: Org mode manual
|
||||
" GNU Info: `$ info Org`
|
||||
" Web: <https://orgmode.org/manual/index.html>
|
||||
|
||||
setlocal commentstring=#%s
|
||||
setlocal comments=fb:*,fb:-,fb:+,b:#,b:\:
|
||||
setlocal formatoptions+=ncqlt
|
||||
let &l:formatlistpat = '^\s*\(\d\+[.)]\|[+-]\)\s\+'
|
||||
|
||||
setlocal foldexpr=org#fold_expr()
|
||||
setlocal foldmethod=expr
|
||||
|
||||
if org#option('org_clean_folds', 0)
|
||||
setlocal foldtext=org#fold_text()
|
||||
setlocal fillchars-=fold:-
|
||||
endif
|
||||
23
ftplugin/outline.vim
Normal file
23
ftplugin/outline.vim
Normal file
@@ -0,0 +1,23 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'org', 'ftplugin/outline.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim filetype plugin for GNU Emacs' Outline mode
|
||||
"
|
||||
" Maintainer: Alex Vear <av@axvr.io>
|
||||
" License: Vim (see `:help license`)
|
||||
" Location: ftplugin/outline.vim
|
||||
" Website: https://github.com/axvr/org.vim
|
||||
" Last Change: 2020-01-04
|
||||
"
|
||||
" Reference Specification: GNU Emacs Manual, section 'Outline Mode'
|
||||
" GNU Info: `$ info Emacs Outline Mode`
|
||||
" Web: <https://www.gnu.org/software/emacs/manual/html_node/emacs/Outline-Mode.html>
|
||||
|
||||
setlocal foldexpr=org#fold_expr()
|
||||
setlocal foldmethod=expr
|
||||
|
||||
if org#option('org_clean_folds', 0)
|
||||
setlocal foldtext=org#fold_text()
|
||||
setlocal fillchars-=fold:-
|
||||
endif
|
||||
@@ -5612,4 +5612,12 @@ filetypes:
|
||||
- name: mermaid
|
||||
patterns:
|
||||
- pattern: '*.mermaid,*.mm,*.mmd'
|
||||
description: Mermaid (https://mermaid-js.github.io/)
|
||||
description: Mermaid (https://mermaid-js.github.io/)
|
||||
---
|
||||
name: org
|
||||
remote: axvr/org.vim
|
||||
filetypes:
|
||||
- name: org
|
||||
patterns:
|
||||
- pattern: '*.org'
|
||||
description: GNU Emacs' Org mode
|
||||
|
||||
145
syntax/org.vim
Normal file
145
syntax/org.vim
Normal file
@@ -0,0 +1,145 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'org', 'syntax/org.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim syntax file for GNU Emacs' Org mode
|
||||
"
|
||||
" Maintainer: Alex Vear <av@axvr.io>
|
||||
" License: Vim (see `:help license`)
|
||||
" Location: syntax/org.vim
|
||||
" Website: https://github.com/axvr/org.vim
|
||||
" Last Change: 2020-01-05
|
||||
"
|
||||
" Reference Specification: Org mode manual
|
||||
" GNU Info: `$ info Org`
|
||||
" Web: <https://orgmode.org/manual/index.html>
|
||||
|
||||
if exists('b:current_syntax') && b:current_syntax !=# 'outline'
|
||||
finish
|
||||
endif
|
||||
|
||||
" Enable spell check for non syntax highlighted text
|
||||
syntax spell toplevel
|
||||
|
||||
|
||||
" Bold, underine, italic, etc.
|
||||
syntax region orgItalic matchgroup=orgItalicDelimiter start="\(^\|[- '"({\]]\)\@<=\/\ze[^ ]" end="^\@!\/\([^\k\/]\|$\)\@=" keepend contains=@Spell
|
||||
syntax region orgBold matchgroup=orgBoldDelimiter start="\(^\|[- '"({\]]\)\@<=\*\ze[^ ]" end="^\@!\*\([^\k\*]\|$\)\@=" keepend contains=@Spell
|
||||
syntax region orgUnderline matchgroup=orgUnderlineDelimiter start="\(^\|[- '"({\]]\)\@<=_\ze[^ ]" end="^\@!_\([^\k_]\|$\)\@=" keepend contains=@Spell
|
||||
syntax region orgStrikethrough matchgroup=orgStrikethroughDelimiter start="\(^\|[ '"({\]]\)\@<=+\ze[^ ]" end="^\@!+\([^\k+]\|$\)\@=" keepend contains=@Spell
|
||||
|
||||
if org#option('org_use_italics', 1)
|
||||
highlight def orgItalic term=italic cterm=italic gui=italic
|
||||
else
|
||||
highlight def orgItalic term=none cterm=none gui=none
|
||||
endif
|
||||
|
||||
highlight def orgBold term=bold cterm=bold gui=bold
|
||||
highlight def orgUnderline term=underline cterm=underline gui=underline
|
||||
highlight def orgStrikethrough term=strikethrough cterm=strikethrough gui=strikethrough
|
||||
highlight def link orgBoldDelimiter orgBold
|
||||
highlight def link orgUnderlineDelimiter orgUnderline
|
||||
highlight def link orgStrikethroughDelimiter orgStrikethrough
|
||||
|
||||
|
||||
" Options
|
||||
syntax match orgOption /^\s*#+\w\+.*$/ keepend
|
||||
syntax region orgTitle matchgroup=orgOption start="\c^\s*#+TITLE:\s*" end="$" keepend oneline
|
||||
highlight def link orgBlockDelimiter SpecialComment
|
||||
highlight def link orgOption SpecialComment
|
||||
highlight def link orgTitle Title
|
||||
|
||||
|
||||
" Code and vervatim text
|
||||
syntax region orgCode matchgroup=orgCodeDelimiter start="\(^\|[- '"({\]]\)\@<=\~\ze[^ ]" end="^\@!\~\([^\k\~]\|$\)\@=" keepend
|
||||
syntax region orgVerbatim matchgroup=orgVerbatimDelimiter start="\(^\|[- '"({\]]\)\@<==\ze[^ ]" end="^\@!=\([^\k=]\|$\)\@=" keepend
|
||||
syntax match orgVerbatim /^\s*: .*$/ keepend
|
||||
syntax region orgVerbatim matchgroup=orgBlockDelimiter start="\c^\s*#+BEGIN_.*" end="\c^\s*#+END_.*" keepend
|
||||
syntax region orgCode matchgroup=orgBlockDelimiter start="\c^\s*#+BEGIN_SRC" end="\c^\s*#+END_SRC" keepend
|
||||
syntax region orgCode matchgroup=orgBlockDelimiter start="\c^\s*#+BEGIN_EXAMPLE" end="\c^\s*#+END_EXAMPLE" keepend
|
||||
|
||||
highlight def link orgVerbatim Identifier
|
||||
highlight def link orgVerbatimDelimiter orgVerbatim
|
||||
highlight def link orgCode Statement
|
||||
highlight def link orgCodeDelimiter orgCode
|
||||
|
||||
|
||||
" Comments
|
||||
syntax match orgComment /^\s*#\s\+.*$/ keepend
|
||||
syntax region orgComment matchgroup=orgBlockDelimiter start="\c^\s*#+BEGIN_COMMENT" end="\c^\s*#+END_COMMENT" keepend
|
||||
highlight def link orgComment Comment
|
||||
|
||||
|
||||
" Headings
|
||||
syntax match orgHeading1 /^\s*\*\{1}\s\+.*$/ keepend contains=@Spell,orgTag,orgTodo,orgMath
|
||||
syntax match orgHeading2 /^\s*\*\{2}\s\+.*$/ keepend contains=@Spell,orgTag,orgTodo,orgMath
|
||||
syntax match orgHeading3 /^\s*\*\{3}\s\+.*$/ keepend contains=@Spell,orgTag,orgTodo,orgMath
|
||||
syntax match orgHeading4 /^\s*\*\{4}\s\+.*$/ keepend contains=@Spell,orgTag,orgTodo,orgMath
|
||||
syntax match orgHeading5 /^\s*\*\{5}\s\+.*$/ keepend contains=@Spell,orgTag,orgTodo,orgMath
|
||||
syntax match orgHeading6 /^\s*\*\{6,}\s\+.*$/ keepend contains=@Spell,orgTag,orgTodo,orgMath
|
||||
|
||||
syntax cluster orgHeadingGroup contains=orgHeading1,orgHeading2,orgHeading3,orgHeading4,orgHeading5,orgHeading6
|
||||
|
||||
syntax match orgTag /:\w\{-}:/ contained contains=orgTag
|
||||
exec 'syntax keyword orgTodo contained ' . join(org#option('org_state_keywords', ['TODO', 'NEXT', 'DONE']), ' ')
|
||||
|
||||
highlight def link orgHeading1 Title
|
||||
highlight def link orgHeading2 orgHeading1
|
||||
highlight def link orgHeading3 orgHeading2
|
||||
highlight def link orgHeading4 orgHeading3
|
||||
highlight def link orgHeading5 orgHeading4
|
||||
highlight def link orgHeading6 orgHeading5
|
||||
highlight def link orgTodo Todo
|
||||
highlight def link orgTag Type
|
||||
|
||||
|
||||
" Lists
|
||||
syntax match orgUnorderedListMarker "^\s*[-+]\s\+" keepend contains=@Spell
|
||||
syntax match orgOrderedListMarker "^\s*\d\+[.)]\s\+" keepend contains=@Spell
|
||||
if org#option('org_list_alphabetical_bullets', 0)
|
||||
syntax match orgOrderedListMarker "^\s*\a[.)]\s\+" keepend contains=@Spell
|
||||
endif
|
||||
highlight def link orgUnorderedListMarker Statement
|
||||
highlight def link orgOrderedListMarker orgUnorderedListMarker
|
||||
|
||||
|
||||
" Timestamps
|
||||
syntax match orgTimestampActive /<\d\{4}-\d\{2}-\d\{2}.\{-}>/ keepend
|
||||
syntax match orgTimestampInactive /\[\d\{4}-\d\{2}-\d\{2}.\{-}\]/ keepend
|
||||
highlight def link orgTimestampActive Operator
|
||||
highlight def link orgTimestampInactive Comment
|
||||
|
||||
|
||||
" Hyperlinks
|
||||
syntax match orgHyperlink /\[\{2}\([^][]\{-1,}\]\[\)\?[^][]\{-1,}\]\{2}/ containedin=ALL contains=orgHyperLeft,orgHyperRight,orgHyperURL
|
||||
syntax match orgHyperLeft /\[\{2}/ contained conceal
|
||||
syntax match orgHyperRight /\]\{2}/ contained conceal
|
||||
syntax match orgHyperURL /[^][]\{-1,}\]\[/ contains=orgHyperCentre contained conceal
|
||||
syntax match orgHyperCentre /\]\[/ contained conceal
|
||||
|
||||
syntax cluster orgHyperlinkBracketsGroup contains=orgHyperLeft,orgHyperRight,orgHyperCentre
|
||||
syntax cluster orgHyperlinkGroup contains=orgHyperlink,orgHyperURL,orgHyperlinkBracketsGroup
|
||||
|
||||
highlight def link orgHyperlink Underlined
|
||||
highlight def link orgHyperURL String
|
||||
highlight def link orgHyperCentre Comment
|
||||
highlight def link orgHyperLeft Comment
|
||||
highlight def link orgHyperRight Comment
|
||||
|
||||
|
||||
" TeX
|
||||
" Ref: https://orgmode.org/manual/LaTeX-fragments.html
|
||||
if org#option('org_highlight_tex', 1)
|
||||
syntax include @LATEX syntax/tex.vim
|
||||
syntax region orgMath start="\\begin\[.*\]{.*}" end="\\end{.*}" keepend contains=@LATEX
|
||||
syntax region orgMath start="\\begin{.*}" end="\\end{.*}" keepend contains=@LATEX
|
||||
syntax region orgMath start="\\\[" end="\\\]" keepend contains=@LATEX
|
||||
syntax region orgMath start="\\(" end="\\)" keepend contains=@LATEX
|
||||
syntax region orgMath start="\S\@<=\$\|\$\S\@=" end="\S\@<=\$\|\$\S\@=" keepend oneline contains=@LATEX
|
||||
syntax region orgMath start=/\$\$/ end=/\$\$/ keepend contains=@LATEX
|
||||
syntax match orgMath /\\\$/ conceal cchar=$
|
||||
highlight def link orgMath String
|
||||
endif
|
||||
|
||||
|
||||
let b:current_syntax = 'org'
|
||||
43
syntax/outline.vim
Normal file
43
syntax/outline.vim
Normal file
@@ -0,0 +1,43 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'org', 'syntax/outline.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim syntax file for GNU Emacs' Outline mode
|
||||
"
|
||||
" Maintainer: Alex Vear <av@axvr.io>
|
||||
" License: Vim (see `:help license`)
|
||||
" Location: syntax/outline.vim
|
||||
" Website: https://github.com/axvr/org.vim
|
||||
" Last Change: 2019-09-28
|
||||
"
|
||||
" Reference Specification: GNU Emacs Manual, section 'Outline Mode'
|
||||
" GNU Info: `$ info Emacs Outline Mode`
|
||||
" Web: <https://www.gnu.org/software/emacs/manual/html_node/emacs/Outline-Mode.html>
|
||||
|
||||
if exists('b:current_syntax')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Enable spell check for non syntax highlighted text
|
||||
syntax spell toplevel
|
||||
|
||||
|
||||
" Headings
|
||||
syntax match outlineHeading1 /^\s*\*\{1}\s\+.*$/ keepend contains=@Spell
|
||||
syntax match outlineHeading2 /^\s*\*\{2}\s\+.*$/ keepend contains=@Spell
|
||||
syntax match outlineHeading3 /^\s*\*\{3}\s\+.*$/ keepend contains=@Spell
|
||||
syntax match outlineHeading4 /^\s*\*\{4}\s\+.*$/ keepend contains=@Spell
|
||||
syntax match outlineHeading5 /^\s*\*\{5}\s\+.*$/ keepend contains=@Spell
|
||||
syntax match outlineHeading6 /^\s*\*\{6,}\s\+.*$/ keepend contains=@Spell
|
||||
|
||||
syntax cluster outlineHeadingGroup contains=outlineHeading1,outlineHeading2,outlineHeading3,outlineHeading4,outlineHeading5,outlineHeading6
|
||||
|
||||
hi def link outlineHeading1 Title
|
||||
hi def link outlineHeading2 outlineHeading1
|
||||
hi def link outlineHeading3 outlineHeading2
|
||||
hi def link outlineHeading4 outlineHeading3
|
||||
hi def link outlineHeading5 outlineHeading4
|
||||
hi def link outlineHeading6 outlineHeading5
|
||||
|
||||
|
||||
let b:current_syntax = 'outline'
|
||||
@@ -653,6 +653,7 @@ call TestFiletype('just')
|
||||
call TestFiletype('nftables')
|
||||
call TestFiletype('openscad')
|
||||
call TestFiletype('mermaid')
|
||||
call TestFiletype('org')
|
||||
|
||||
" DO NOT EDIT CODE ABOVE, IT IS GENERATED WITH MAKEFILE
|
||||
|
||||
|
||||
Reference in New Issue
Block a user