]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.4891: Vim help presentation could be better v8.2.4891
authorBram Moolenaar <Bram@vim.org>
Fri, 6 May 2022 15:32:46 +0000 (16:32 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 6 May 2022 15:32:46 +0000 (16:32 +0100)
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.

Filelist
runtime/import/dist/vimhelp.vim [new file with mode: 0644]
src/version.c

index bc44866d64cbe79f56d45ebfc138ce093d32654d..af5fcc5a37b47226c41e7539571bbb82bdcc7b37 100644 (file)
--- a/Filelist
+++ b/Filelist
@@ -722,6 +722,7 @@ RT_ALL =    \
                runtime/doc/xxd.1 \
                runtime/ftoff.vim \
                runtime/gvimrc_example.vim \
+               runtime/import/dist/vimhelp.vim \
                runtime/macros/README.txt \
                runtime/macros/editexisting.vim \
                runtime/macros/hanoi/click.me \
diff --git a/runtime/import/dist/vimhelp.vim b/runtime/import/dist/vimhelp.vim
new file mode 100644 (file)
index 0000000..1f58725
--- /dev/null
@@ -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
index d5b33337a751941dd266cb82e1095cd7697c2f3c..57dec85572f62206806d58054ada4c8950d1ab79 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4891,
 /**/
     4890,
 /**/