view runtime/import/dist/vimhelp.vim @ 29104:c58baa6d6dda

Update runtime files Commit: https://github.com/vim/vim/commit/63f32603789d1a27c559fc440325955fd0b8b500 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jun 9 20:45:54 2022 +0100 Update runtime files
author Bram Moolenaar <Bram@vim.org>
date Thu, 09 Jun 2022 22:00:06 +0200
parents 64c3323117b4
children 2a1f9b4a5ac9
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\s')
    if word->hlexists()
      var name = 'help-hl-' .. word
      if prop_type_list({bufnr: buf})->match(name) == -1
	prop_type_add('help-hl-' .. word, {
	  bufnr: buf,
	  highlight: word,
	  combine: false,
	  })
      else
	# was called before, delete existing properties
	prop_remove({type: name, bufnr: buf})
      endif
      prop_add(lnum, 1, {length: word->strlen(), type: 'help-hl-' .. word})
    endif
    ++lnum
  endwhile
enddef