summaryrefslogtreecommitdiff
path: root/vim/pack/downloads/opt/lsp/syntax/lspgfm.vim
diff options
context:
space:
mode:
authorMarc Coquand <marc@mccd.space>2024-07-01 21:26:30 -0500
committerMarc Coquand <marc@mccd.space>2024-07-01 21:26:30 -0500
commit0a20357d4585da91d92252972f3eb7b715ff64ab (patch)
treec1e228d72b6331e89f72d99a1ba4ba1807d60381 /vim/pack/downloads/opt/lsp/syntax/lspgfm.vim
downloadbsd-0a20357d4585da91d92252972f3eb7b715ff64ab.tar.gz
bsd-0a20357d4585da91d92252972f3eb7b715ff64ab.tar.bz2
bsd-0a20357d4585da91d92252972f3eb7b715ff64ab.zip
initial commit
Diffstat (limited to 'vim/pack/downloads/opt/lsp/syntax/lspgfm.vim')
-rw-r--r--vim/pack/downloads/opt/lsp/syntax/lspgfm.vim23
1 files changed, 23 insertions, 0 deletions
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<string> = {}
+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