vim

Fork of vim, an acceptable text editor
git clone git://git.laack.co/vim.git
Log | Files | Refs | README | LICENSE

vimhelp.vim (840B)


      1 vim9script
      2 
      3 # Extra functionality for displaying Vim help .
      4 
      5 # Called when editing the doc/syntax.txt file
      6 export def HighlightGroups()
      7   var save_cursor = getcurpos()
      8   var buf: number = bufnr('%')
      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')
     14     if word->hlexists()
     15       var type = 'help-hl-' .. word
     16       if prop_type_list({bufnr: buf})->index(type) != -1
     17 	# was called before, delete existing properties
     18 	prop_remove({type: type, bufnr: buf})
     19 	prop_type_delete(type, {bufnr: buf})
     20       endif
     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})
     27     endif
     28   endfor
     29 
     30   setpos('.', save_cursor)
     31 enddef