Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
hostconf.vim148 linesDownload Raw Back to syntax
1" Vim syntax file2" Language:             host.conf(5) configuration file3" Previous Maintainer:  Nikolai Weibull <now@bitwi.se>4" Latest Revision:      2007-06-255 6if exists("b:current_syntax")7  finish8endif9 10let s:cpo_save = &cpo11set cpo&vim12 13syn keyword hostconfTodo14      \ contained15      \ TODO16      \ FIXME17      \ XXX18      \ NOTE19 20syn match   hostconfComment21      \ display22      \ contained23      \ '\s*#.*'24      \ contains=hostconfTodo,25      \          @Spell26 27syn match   hostconfBegin28      \ display29      \ '^'30      \ nextgroup=hostconfComment,hostconfKeyword31      \ skipwhite32 33syn keyword hostconfKeyword34      \ contained35      \ order36      \ nextgroup=hostconfLookupOrder37      \ skipwhite38 39let s:orders = ['bind', 'hosts', 'nis']40 41function s:permute_suffixes(list)42  if empty(a:list)43    return []44  elseif len(a:list) == 145    return a:list[0]46  else47    let i = 048    let n = len(a:list)49    let sub_permutations = []50    while i < n51      let list_copy = copy(a:list)52      let removed = list_copy[i]53      call remove(list_copy, i)54      call add(sub_permutations, [removed, s:permute_suffixes(list_copy)])55      let i += 156    endwhile57    return sub_permutations58  endif59endfunction60 61function s:generate_suffix_groups(list_of_order_of_orders, context, trailing_context)62  for order_of_orders in a:list_of_order_of_orders63    let order = order_of_orders[0]64    let trailing_context = a:trailing_context . toupper(order[0]) . order[1:]65    let nextgroup = 'hostconfLookupOrder' . trailing_context66    let nextgroup_delimiter = nextgroup . 'Delimiter'67    let group = 'hostconfLookupOrder' . a:context68    execute 'syn keyword' group 'contained' order 'nextgroup=' . nextgroup_delimiter 'skipwhite'69    execute 'syn match' nextgroup_delimiter 'contained display "," nextgroup=' . nextgroup 'skipwhite'70    if a:context != ""71      execute 'hi def link' group 'hostconfLookupOrder'72    endif73    execute 'hi def link' nextgroup_delimiter 'hostconfLookupOrderDelimiter'74    let context = trailing_context75    if type(order_of_orders[1]) == type([])76      call s:generate_suffix_groups(order_of_orders[1], context, trailing_context)77    else78      execute 'syn keyword hostconfLookupOrder' . context 'contained' order_of_orders[-1]79      execute 'hi def link hostconfLookupOrder' . context 'hostconfLookupOrder'80    endif81  endfor82endfunction83 84call s:generate_suffix_groups(s:permute_suffixes(s:orders), "", "")85 86delfunction s:generate_suffix_groups87delfunction s:permute_suffixes88 89syn keyword hostconfKeyword90      \ contained91      \ trim92      \ nextgroup=hostconfDomain93      \ skipwhite94 95syn match   hostconfDomain96      \ contained97      \ '\.[^:;,[:space:]]\+'98      \ nextgroup=hostconfDomainDelimiter99      \ skipwhite100 101syn match   hostconfDomainDelimiter102      \ contained103      \ display104      \ '[:;,]'105      \ nextgroup=hostconfDomain106      \ skipwhite107 108syn keyword hostconfKeyword109      \ contained110      \ multi111      \ nospoof112      \ spoofalert113      \ reorder114      \ nextgroup=hostconfBoolean115      \ skipwhite116 117syn keyword hostconfBoolean118      \ contained119      \ on120      \ off121 122syn keyword hostconfKeyword123      \ contained124      \ spoof125      \ nextgroup=hostconfSpoofValue126      \ skipwhite127 128syn keyword hostconfSpoofValue129      \ contained130      \ off131      \ nowarn132      \ warn133 134hi def link hostconfTodo                  Todo135hi def link hostconfComment               Comment136hi def link hostconfKeyword               Keyword137hi def link hostconfLookupOrder           Identifier138hi def link hostconfLookupOrderDelimiter  Delimiter139hi def link hostconfDomain                String140hi def link hostconfDomainDelimiter       Delimiter141hi def link hostconfBoolean               Boolean142hi def link hostconfSpoofValue            hostconfBoolean143 144let b:current_syntax = "hostconf"145 146let &cpo = s:cpo_save147unlet s:cpo_save148 
codekingpro/portable-devtools · Team Ai