blob: 08929bbdbe09768db403a4d9166c7f81016e247b [file] [log] [blame]
Gregory Anders1cc4cae2024-07-15 20:00:48 +02001" Vim filetype plugin file
2" Language: Typst
Luca Saccarolab66cac12024-12-09 20:29:14 +01003" Previous Maintainer: Gregory Anders
4" Maintainer: Luca Saccarola <github.e41mv@aleeas.com>
5" Last Change: 2024 Dec 09
Gregory Anders1cc4cae2024-07-15 20:00:48 +02006" Based on: https://github.com/kaarmu/typst.vim
Riley Bruinsc3d5c2f2024-05-20 05:08:49 -07007
8if exists('b:did_ftplugin')
9 finish
10endif
11let b:did_ftplugin = 1
12
Gregory Anders1cc4cae2024-07-15 20:00:48 +020013setlocal commentstring=//\ %s
14setlocal comments=s1:/*,mb:*,ex:*/,://
Luca Saccarola9a394832024-12-01 20:12:26 +010015setlocal formatoptions+=croqn
Luca Saccarolab66cac12024-12-09 20:29:14 +010016" Numbered Lists
Luca Saccarola9a394832024-12-01 20:12:26 +010017setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}\\t\ ]\\s*
Luca Saccarolab66cac12024-12-09 20:29:14 +010018" Unordered (-), Ordered (+) and definition (/) Lists
19setlocal formatlistpat+=\\\|^\\s*[-+/\]\\s\\+
Gregory Anders1cc4cae2024-07-15 20:00:48 +020020setlocal suffixesadd=.typ
21
Luca Saccarola9a394832024-12-01 20:12:26 +010022let b:undo_ftplugin = 'setl cms< com< fo< flp< sua<'
Gregory Anders1cc4cae2024-07-15 20:00:48 +020023
24if get(g:, 'typst_conceal', 0)
25 setlocal conceallevel=2
26 let b:undo_ftplugin .= ' cole<'
27endif
Konfekt7c3f9af2024-10-05 17:26:46 +020028
Luca Saccarola421ed142024-10-21 22:01:10 +020029if has("folding") && get(g:, 'typst_folding', 0)
30 setlocal foldexpr=typst#foldexpr()
31 setlocal foldmethod=expr
32 let b:undo_ftplugin .= "|setl foldexpr< foldmethod<"
33endif
34
Konfekt7c3f9af2024-10-05 17:26:46 +020035if !exists('current_compiler')
36 compiler typst
37 let b:undo_ftplugin ..= "| compiler make"
38endif