Mercurial > vim
annotate runtime/import/dist/vimhelp.vim @ 34672:267f245904a9
Added tag v9.1.0217 for changeset df52075b12cd00ca5122b3ea990e2b5b2361eea3
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 28 Mar 2024 10:30:05 +0100 |
parents | 2a1f9b4a5ac9 |
children |
rev | line source |
---|---|
28733
db38dab0e525
patch 8.2.4891: Vim help presentation could be better
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1 vim9script |
db38dab0e525
patch 8.2.4891: Vim help presentation could be better
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2 |
db38dab0e525
patch 8.2.4891: Vim help presentation could be better
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3 # Extra functionality for displaying Vim help . |
db38dab0e525
patch 8.2.4891: Vim help presentation could be better
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4 |
db38dab0e525
patch 8.2.4891: Vim help presentation could be better
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
5 # Called when editing the doc/syntax.txt file |
db38dab0e525
patch 8.2.4891: Vim help presentation could be better
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
6 export def HighlightGroups() |
29121 | 7 var save_cursor = getcurpos() |
28733
db38dab0e525
patch 8.2.4891: Vim help presentation could be better
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
8 var buf: number = bufnr('%') |
29121 | 9 |
10 var start: number = search('\*highlight-groups\*', 'c') | |
11 var end: number = search('^======') | |
12 for lnum in range(start, end) | |
13 var word: string = getline(lnum)->matchstr('^\w\+\ze\t') | |
28733
db38dab0e525
patch 8.2.4891: Vim help presentation could be better
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
14 if word->hlexists() |
29121 | 15 var type = 'help-hl-' .. word |
16 if prop_type_list({bufnr: buf})->index(type) != -1 | |
28837
64c3323117b4
patch 8.2.4942: error when setting 'filetype' in help file again
Bram Moolenaar <Bram@vim.org>
parents:
28733
diff
changeset
|
17 # was called before, delete existing properties |
29121 | 18 prop_remove({type: type, bufnr: buf}) |
19 prop_type_delete(type, {bufnr: buf}) | |
28837
64c3323117b4
patch 8.2.4942: error when setting 'filetype' in help file again
Bram Moolenaar <Bram@vim.org>
parents:
28733
diff
changeset
|
20 endif |
29121 | 21 prop_type_add(type, { |
22 bufnr: buf, | |
23 highlight: word, | |
24 combine: false, | |
25 }) | |
26 prop_add(lnum, 1, {length: word->strlen(), type: type}) | |
28733
db38dab0e525
patch 8.2.4891: Vim help presentation could be better
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
27 endif |
29121 | 28 endfor |
29 | |
30 setpos('.', save_cursor) | |
28733
db38dab0e525
patch 8.2.4891: Vim help presentation could be better
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
31 enddef |