summaryrefslogtreecommitdiffstats
path: root/runtime/import
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-05-06 16:32:46 +0100
committerBram Moolenaar <Bram@vim.org>2022-05-06 16:32:46 +0100
commitb3c9077a5be76cd88b9a0c07b6d6c072d5c8ac3e (patch)
treeb4b6b7872fa5e5409c6a7730690e4f3df60b347b /runtime/import
parentcf030578b26460643dca4a40e7f2e3bc19c749aa (diff)
patch 8.2.4891: Vim help presentation could be betterv8.2.4891
Problem: Vim help presentation could be better. Solution: Add an imported file for extra Vim help support. Show highlight names in the color they have.
Diffstat (limited to 'runtime/import')
-rw-r--r--runtime/import/dist/vimhelp.vim21
1 files changed, 21 insertions, 0 deletions
diff --git a/runtime/import/dist/vimhelp.vim b/runtime/import/dist/vimhelp.vim
new file mode 100644
index 0000000000..1f587251b9
--- /dev/null
+++ b/runtime/import/dist/vimhelp.vim
@@ -0,0 +1,21 @@
+vim9script
+
+# Extra functionality for displaying Vim help .
+
+# Called when editing the doc/syntax.txt file
+export def HighlightGroups()
+ var buf: number = bufnr('%')
+ var lnum: number = search('\*highlight-groups\*', 'cn')
+ while getline(lnum) !~ '===' && lnum < line('$')
+ var word: string = getline(lnum)->matchstr('^\w\+\ze\t')
+ if word->hlexists()
+ prop_type_add('help-hl-' .. word, {
+ bufnr: buf,
+ highlight: word,
+ combine: false,
+ })
+ prop_add(lnum, 1, {length: word->strlen(), type: 'help-hl-' .. word})
+ endif
+ ++lnum
+ endwhile
+enddef