runtime(typst): add folding to typst ftplugin

closes: #15897

Signed-off-by: Gregory Anders <greg@gpanders.com>
Signed-off-by: Luca Saccarola <github.e41mv@aleeas.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Luca Saccarola
2024-10-21 22:01:10 +02:00
committed by Christian Brabandt
parent a7d456191d
commit 421ed14b8a
4 changed files with 49 additions and 3 deletions

View File

@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: Typst
" Maintainer: Gregory Anders
" Last Change: 2024 Oct 04
" Last Change: 2024 Oct 21
" Based on: https://github.com/kaarmu/typst.vim
if exists('b:did_ftplugin')
@ -21,6 +21,12 @@ if get(g:, 'typst_conceal', 0)
let b:undo_ftplugin .= ' cole<'
endif
if has("folding") && get(g:, 'typst_folding', 0)
setlocal foldexpr=typst#foldexpr()
setlocal foldmethod=expr
let b:undo_ftplugin .= "|setl foldexpr< foldmethod<"
endif
if !exists('current_compiler')
compiler typst
let b:undo_ftplugin ..= "| compiler make"