Mercurial > vim
view runtime/import/dist/vimhelp.vim @ 28837:64c3323117b4 v8.2.4942
patch 8.2.4942: error when setting 'filetype' in help file again
Commit: https://github.com/vim/vim/commit/de216732d45caa87e6f08f4319aa71e805a89a0e
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu May 12 17:24:49 2022 +0100
patch 8.2.4942: error when setting 'filetype' in help file again
Problem: Error when setting 'filetype' in help file again.
Solution: Deal with text property type already existing. (closes https://github.com/vim/vim/issues/10409)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 12 May 2022 18:30:05 +0200 |
parents | db38dab0e525 |
children | c58baa6d6dda |
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() 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