summaryrefslogtreecommitdiff
path: root/vim/pack/downloads/opt/lsp/syntax/lspgfm.vim
diff options
context:
space:
mode:
authorMarc Coquand <marc@mccd.space>2024-06-30 17:20:44 -0500
committerMarc Coquand <marc@mccd.space>2024-06-30 17:20:44 -0500
commitaeabdffa8870c2b90a32f53c1d0e5b63367a6e27 (patch)
treed3b8e3395cbfc5c9ba4f1dd28ff807f18d582b26 /vim/pack/downloads/opt/lsp/syntax/lspgfm.vim
parent97ce8456231b997135be6c5f1afaee08eff2cbb1 (diff)
downloadrcm-aeabdffa8870c2b90a32f53c1d0e5b63367a6e27.tar.gz
rcm-aeabdffa8870c2b90a32f53c1d0e5b63367a6e27.tar.bz2
rcm-aeabdffa8870c2b90a32f53c1d0e5b63367a6e27.zip
Vim
Diffstat (limited to '')
-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