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:
16
ftplugin/outline.vim
Normal file
16
ftplugin/outline.vim
Normal 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
|
||||
Reference in New Issue
Block a user