vim

Fork of vim, an acceptable text editor
git clone git://git.laack.co/vim.git
Log | Files | Refs | README | LICENSE

typst.vim (1645B)


      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 
      9 if exists("b:did_ftplugin")
     10   finish
     11 endif
     12 let b:did_ftplugin = 1
     13 
     14 setlocal commentstring=//\ %s
     15 setlocal comments=s1:/*,mb:*,ex:*/,://
     16 setlocal formatoptions+=croqn
     17 " Numbered Lists
     18 setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}\\t\ ]\\s*
     19 " Unordered (-), Ordered (+) and definition (/) Lists
     20 setlocal formatlistpat+=\\\|^\\s*[-+/\]\\s\\+
     21 setlocal suffixesadd=.typ
     22 
     23 let b:undo_ftplugin = "setl cms< com< fo< flp< sua<"
     24 
     25 if get(g:, "typst_conceal", 0)
     26   setlocal conceallevel=2
     27   let b:undo_ftplugin ..= " cole<"
     28 endif
     29 
     30 if 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<"
     36 endif
     37 
     38 if has("folding") && get(g:, "typst_folding", 0)
     39   setlocal foldexpr=typst#foldexpr()
     40   setlocal foldmethod=expr
     41   let b:undo_ftplugin ..= " | setl foldexpr< foldmethod<"
     42 endif
     43 
     44 if !exists("current_compiler")
     45   compiler typst
     46   let b:undo_ftplugin ..= " | compiler make"
     47 endif
     48 
     49 if (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"
     57 endif