robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

zeertzjqvim-patch:dd89754: runtime(typst): Improve ftplugin, and syntax file567053bb3c

master
1.6 KiB57 linesraw
1" Vim filetype plugin file
2" Language:             Typst
3" Maintainer:           Maxim Kim <habamax@gmail.com>
4" Previous Maintainers: Gregory Anders
5"                       Luca Saccarola <github.e41mv@aleeas.com>
6" Last Change:          2026 Jun 29
7" Based on the ftplugin from https://github.com/kaarmu/typst.vim
8
9if exists("b:did_ftplugin")
10  finish
11endif
12let b:did_ftplugin = 1
13
14setlocal commentstring=//\ %s
15setlocal comments=s1:/*,mb:*,ex:*/,://
16setlocal formatoptions+=croqn
17" Numbered Lists
18setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}\\t\ ]\\s*
19" Unordered (-), Ordered (+) and definition (/) Lists
20setlocal formatlistpat+=\\\|^\\s*[-+/\]\\s\\+
21setlocal suffixesadd=.typ
22
23let b:undo_ftplugin = "setl cms< com< fo< flp< sua<"
24
25if get(g:, "typst_conceal", 0)
26  setlocal conceallevel=2
27  let b:undo_ftplugin ..= " cole<"
28endif
29
30if get(g:, 'typst_recommended_style',
31      \ get(g:, 'filetype_recommended_style', 1))
32  setlocal expandtab
33  setlocal softtabstop=2
34  setlocal shiftwidth=2
35  let b:undo_ftplugin ..= " | setl et< sts< sw<"
36endif
37
38if has("folding") && get(g:, "typst_folding", 0)
39  setlocal foldexpr=typst#foldexpr()
40  setlocal foldmethod=expr
41  let b:undo_ftplugin ..= " | setl foldexpr< foldmethod<"
42endif
43
44if !exists("current_compiler")
45  compiler typst
46  let b:undo_ftplugin ..= " | compiler make"
47endif
48
49if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
50  let  b:browsefilter = "Typst Markup file (*.typ)\t*.typ\n"
51  if has("win32")
52    let b:browsefilter ..= "All Files (*.*)\t*\n"
53  else
54    let b:browsefilter ..= "All Files (*)\t*\n"
55  endif
56  let b:undo_ftplugin ..= " | unlet! b:browsefilter"
57endif