annotate runtime/import/dist/vimhelp.vim @ 29235:fbcbc953c2ec

Added tag v8.2.5136 for changeset 96ff6c230a66c0b91cb6b1aebbb3869cb5fb0414
author Bram Moolenaar <Bram@vim.org>
date Sun, 19 Jun 2022 21:15:03 +0200
parents 2a1f9b4a5ac9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
2a1f9b4a5ac9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 29104
diff changeset
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
2a1f9b4a5ac9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 29104
diff changeset
9
2a1f9b4a5ac9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 29104
diff changeset
10 var start: number = search('\*highlight-groups\*', 'c')
2a1f9b4a5ac9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 29104
diff changeset
11 var end: number = search('^======')
2a1f9b4a5ac9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 29104
diff changeset
12 for lnum in range(start, end)
2a1f9b4a5ac9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 29104
diff changeset
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
2a1f9b4a5ac9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 29104
diff changeset
15 var type = 'help-hl-' .. word
2a1f9b4a5ac9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 29104
diff changeset
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
2a1f9b4a5ac9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 29104
diff changeset
18 prop_remove({type: type, bufnr: buf})
2a1f9b4a5ac9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 29104
diff changeset
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
2a1f9b4a5ac9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 29104
diff changeset
21 prop_type_add(type, {
2a1f9b4a5ac9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 29104
diff changeset
22 bufnr: buf,
2a1f9b4a5ac9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 29104
diff changeset
23 highlight: word,
2a1f9b4a5ac9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 29104
diff changeset
24 combine: false,
2a1f9b4a5ac9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 29104
diff changeset
25 })
2a1f9b4a5ac9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 29104
diff changeset
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
2a1f9b4a5ac9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 29104
diff changeset
28 endfor
2a1f9b4a5ac9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 29104
diff changeset
29
2a1f9b4a5ac9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 29104
diff changeset
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