view runtime/import/dist/vimhelp.vim @ 28733:db38dab0e525 v8.2.4891

patch 8.2.4891: Vim help presentation could be better Commit: https://github.com/vim/vim/commit/b3c9077a5be76cd88b9a0c07b6d6c072d5c8ac3e Author: Bram Moolenaar <Bram@vim.org> Date: Fri May 6 16:32:46 2022 +0100 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.
author Bram Moolenaar <Bram@vim.org>
date Fri, 06 May 2022 17:45:03 +0200
parents
children 64c3323117b4
line wrap: on
line source

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