Add org_clean_folds option

This commit is contained in:
Alex Vear
2020-01-04 20:11:52 +00:00
parent d2ecdb4ed3
commit ebbc3efac2
5 changed files with 70 additions and 24 deletions

View File

@@ -4,7 +4,7 @@
" License: Vim (see `:help license`)
" Location: ftplugin/org.vim
" Website: https://github.com/axvr/org.vim
" Last Change: 2019-09-22
" Last Change: 2020-01-04
"
" Reference Specification: Org mode manual
" GNU Info: `$ info Org`
@@ -12,17 +12,15 @@
setlocal commentstring=#%s
function! OrgFold()
let l:depth = match(getline(v:lnum), '\(^\*\+\)\@<=\( .*$\)\@=')
if l:depth > 0 && synIDattr(synID(v:lnum, 1, 1), 'name') =~# 'orgHeading'
return ">" . l:depth
endif
return "="
endfunction
setlocal foldexpr=OrgFold()
setlocal foldexpr=org#fold_expr()
setlocal foldmethod=expr
if org#option('org_clean_folds', 0)
setlocal foldtext=org#fold_text()
setlocal fillchars-=fold:-
setlocal fillchars-=fold:\
endif
" Conceal Org mode link syntax
if org#option('org_conceal_links', 1)
setlocal conceallevel=2

View File

@@ -4,19 +4,17 @@
" License: Vim (see `:help license`)
" Location: ftplugin/outline.vim
" Website: https://github.com/axvr/org.vim
" Last Change: 2019-09-22
" 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>
function! OutlineFold()
let l:depth = match(getline(v:lnum), '\(^\*\+\)\@<=\( .*$\)\@=')
if l:depth > 0 && synIDattr(synID(v:lnum, 1, 1), 'name') =~# 'outlineHeading'
return ">" . l:depth
endif
return "="
endfunction
setlocal foldexpr=OutlineFold()
setlocal foldexpr=org#fold_expr()
setlocal foldmethod=expr
if org#option('org_clean_folds', 0)
setlocal foldtext=org#fold_text()
setlocal fillchars-=fold:-
setlocal fillchars-=fold:\
endif