0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00
vim/runtime/import/dist/vimhelp.vim

28 lines
777 B
VimL
Raw Normal View History

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('$')
2022-06-09 20:45:54 +01:00
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