diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2021-06-09 21:37:56 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2021-06-09 21:37:56 +0200 |
commit | 4899585281beab51e5dff1d9ae4d3159244a8275 (patch) | |
tree | 1624741b8d1a5366568addbb90b1119587636459 /autoload | |
parent | 4f997c5c82d49ce3e2791eb0679e992751bf39a7 (diff) | |
download | vim-polyglot-4899585281beab51e5dff1d9ae4d3159244a8275.tar.gz vim-polyglot-4899585281beab51e5dff1d9ae4d3159244a8275.zip |
Add org mode, close #706
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/org.vim | 30 | ||||
-rw-r--r-- | autoload/polyglot/init.vim | 4 | ||||
-rw-r--r-- | autoload/polyglot/sleuth.vim | 1 |
3 files changed, 35 insertions, 0 deletions
diff --git a/autoload/org.vim b/autoload/org.vim new file mode 100644 index 00000000..de8282c2 --- /dev/null +++ b/autoload/org.vim @@ -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 diff --git a/autoload/polyglot/init.vim b/autoload/polyglot/init.vim index 781c9e57..7aa94939 100644 --- a/autoload/polyglot/init.vim +++ b/autoload/polyglot/init.vim @@ -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 diff --git a/autoload/polyglot/sleuth.vim b/autoload/polyglot/sleuth.vim index 095be910..0785dfbf 100644 --- a/autoload/polyglot/sleuth.vim +++ b/autoload/polyglot/sleuth.vim @@ -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', |