From b3c9077a5be76cd88b9a0c07b6d6c072d5c8ac3e Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 6 May 2022 16:32:46 +0100 Subject: patch 8.2.4891: Vim help presentation could be better 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 | 1 + runtime/import/dist/vimhelp.vim | 21 +++++++++++++++++++++ src/version.c | 2 ++ 3 files changed, 24 insertions(+) create mode 100644 runtime/import/dist/vimhelp.vim diff --git a/Filelist b/Filelist index bc44866d64..af5fcc5a37 100644 --- 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 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 diff --git a/src/version.c b/src/version.c index d5b33337a7..57dec85572 100644 --- a/src/version.c +++ b/src/version.c @@ -746,6 +746,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 4891, /**/ 4890, /**/ -- cgit v1.2.3