blob: 3841e427f3039c12a4cbed869f87ab5718e0ed0a [file] [log] [blame]
Gregory Anders1cc4cae2024-07-15 20:00:48 +02001" Vim filetype plugin file
2" Language: Typst
3" Maintainer: Gregory Anders
Luca Saccarola421ed142024-10-21 22:01:10 +02004" Last Change: 2024 Oct 21
Gregory Anders1cc4cae2024-07-15 20:00:48 +02005" Based on: https://github.com/kaarmu/typst.vim
Riley Bruinsc3d5c2f2024-05-20 05:08:49 -07006
7if exists('b:did_ftplugin')
8 finish
9endif
10let b:did_ftplugin = 1
11
Gregory Anders1cc4cae2024-07-15 20:00:48 +020012setlocal commentstring=//\ %s
13setlocal comments=s1:/*,mb:*,ex:*/,://
14setlocal formatoptions+=croq
15setlocal suffixesadd=.typ
16
17let b:undo_ftplugin = 'setl cms< com< fo< sua<'
18
19if get(g:, 'typst_conceal', 0)
20 setlocal conceallevel=2
21 let b:undo_ftplugin .= ' cole<'
22endif
Konfekt7c3f9af2024-10-05 17:26:46 +020023
Luca Saccarola421ed142024-10-21 22:01:10 +020024if has("folding") && get(g:, 'typst_folding', 0)
25 setlocal foldexpr=typst#foldexpr()
26 setlocal foldmethod=expr
27 let b:undo_ftplugin .= "|setl foldexpr< foldmethod<"
28endif
29
Konfekt7c3f9af2024-10-05 17:26:46 +020030if !exists('current_compiler')
31 compiler typst
32 let b:undo_ftplugin ..= "| compiler make"
33endif