blob: 09b65d0e52ab59be02dfb1ef49d860583cfcc676 [file] [log] [blame]
Gregory Anders1cc4cae2024-07-15 20:00:48 +02001" Vim filetype plugin file
2" Language: Typst
3" Maintainer: Gregory Anders
Luca Saccarola9a394832024-12-01 20:12:26 +01004" Last Change: 2024 Dev 01
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:*/,://
Luca Saccarola9a394832024-12-01 20:12:26 +010014setlocal formatoptions+=croqn
15setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}\\t\ ]\\s*
16setlocal formatlistpat+=\\\|^\\s*[-+\]\\s\\+
Gregory Anders1cc4cae2024-07-15 20:00:48 +020017setlocal suffixesadd=.typ
18
Luca Saccarola9a394832024-12-01 20:12:26 +010019let b:undo_ftplugin = 'setl cms< com< fo< flp< sua<'
Gregory Anders1cc4cae2024-07-15 20:00:48 +020020
21if get(g:, 'typst_conceal', 0)
22 setlocal conceallevel=2
23 let b:undo_ftplugin .= ' cole<'
24endif
Konfekt7c3f9af2024-10-05 17:26:46 +020025
Luca Saccarola421ed142024-10-21 22:01:10 +020026if has("folding") && get(g:, 'typst_folding', 0)
27 setlocal foldexpr=typst#foldexpr()
28 setlocal foldmethod=expr
29 let b:undo_ftplugin .= "|setl foldexpr< foldmethod<"
30endif
31
Konfekt7c3f9af2024-10-05 17:26:46 +020032if !exists('current_compiler')
33 compiler typst
34 let b:undo_ftplugin ..= "| compiler make"
35endif