Add port of GNU Emacs' Outline mode

<https://www.gnu.org/software/emacs/manual/html_node/emacs/Outline-Mode.html>
This commit is contained in:
Alex Vear
2019-09-22 16:26:28 +01:00
parent 5d7efcb452
commit 8890503965
2 changed files with 45 additions and 0 deletions

16
ftplugin/outline.vim Normal file
View File

@@ -0,0 +1,16 @@
" =============================================================
" Description: Folding for GNU Emacs' Outline mode
" Author: Alex Vear (axvr) <av@axvr.io>
" Licence: ISC (2019)
" =============================================================
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 foldmethod=expr