From 84a51767ed467994b327cfde7425e59397b209ea Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Wed, 21 Aug 2024 20:07:33 -0400 Subject: [PATCH] Update syntax: alternative block comment and nvim-lsp based highlight for bold and italic --- autoload/typst/options.vim | 1 + syntax/typst.vim | 80 ++++++++++++++++++++++---------------- 2 files changed, 47 insertions(+), 34 deletions(-) diff --git a/autoload/typst/options.vim b/autoload/typst/options.vim index 372b33d..47c6c4d 100644 --- a/autoload/typst/options.vim +++ b/autoload/typst/options.vim @@ -10,6 +10,7 @@ function! typst#options#init() abort " {{{1 call s:declare_option('typst_conceal', 0) call s:declare_option('typst_conceal_math', g:typst_conceal) call s:declare_option('typst_conceal_emoji', g:typst_conceal) + call s:declare_option('typst_syntax_use_lsp', 0) call s:declare_option('typst_auto_close_toc', 0) call s:declare_option('typst_auto_open_quickfix', 1) call s:declare_option('typst_embedded_languages', []) diff --git a/syntax/typst.vim b/syntax/typst.vim index cef199f..2e8b1e8 100644 --- a/syntax/typst.vim +++ b/syntax/typst.vim @@ -1,7 +1,8 @@ -" Vim syntax file +" Vim syntax file using LSP " Language: Typst " Maintainer: Kaj Munhoz Arfvidsson -" Upstream: https://github.com/kaarmu/typst.vim +" Upstream: +" if exists("b:current_syntax") | finish | endif @@ -18,8 +19,9 @@ syntax cluster typstCommon " Common > Comment {{{2 syntax cluster typstComment \ contains=typstCommentBlock,typstCommentLine -syntax match typstCommentBlock - \ #/\*\%(\_.\{-}\)\*/# +syntax region typstCommentBlock + \ start="/\*" + \ end="\*/" \ contains=typstCommentTodo,@Spell syntax match typstCommentLine \ #//.*# @@ -321,38 +323,48 @@ syntax region typstMarkupTermList \ contains=@typstMarkup " Bold & Italic -syntax match typstMarkupBold - \ /\v(\w|\\)@1