From aeabdffa8870c2b90a32f53c1d0e5b63367a6e27 Mon Sep 17 00:00:00 2001 From: Marc Coquand Date: Sun, 30 Jun 2024 17:20:44 -0500 Subject: Vim --- vim/pack/downloads/opt/lsp/syntax/lspgfm.vim | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 vim/pack/downloads/opt/lsp/syntax/lspgfm.vim (limited to 'vim/pack/downloads/opt/lsp/syntax/lspgfm.vim') diff --git a/vim/pack/downloads/opt/lsp/syntax/lspgfm.vim b/vim/pack/downloads/opt/lsp/syntax/lspgfm.vim new file mode 100644 index 0000000..9e71010 --- /dev/null +++ b/vim/pack/downloads/opt/lsp/syntax/lspgfm.vim @@ -0,0 +1,23 @@ +vim9script + +if get(b:, 'markdown_fallback', v:false) + runtime! syntax/markdown.vim + finish +endif + +var group: dict = {} +for region in get(b:, 'lsp_syntax', []) + if !group->has_key(region.lang) + group[region.lang] = region.lang->substitute('\(^.\|_\a\)', '\u&', 'g') + try + exe $'syntax include @{group[region.lang]} syntax/{region.lang}.vim' + catch /.*/ + group[region.lang] = '' + endtry + endif + if !group[region.lang]->empty() + exe $'syntax region lspCodeBlock start="{region.start}" end="{region.end}" contains=@{group[region.lang]}' + endif +endfor + +# vim: tabstop=8 shiftwidth=2 softtabstop=2 -- cgit v1.2.3