summaryrefslogtreecommitdiff
path: root/runtime/syntax/modconf.vim
blob: 569e134492b9976987862a51a3dee92cf6d09ac9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
" Vim syntax file
" Language:	    Linux modutils modules.conf File
" Maintainer:	    Nikolai Weibull <source@pcppopper.org>
" URL:		    http://www.pcppopper.org/vim/syntax/pcp/modconf/
" Latest Revision:  2004-05-22
" arch-tag:	    b7981bdb-daa3-41d1-94b5-a3d60b627916

if version < 600
  syntax clear
elseif exists("b:current_syntax")
  finish
endif

" comments
syn region  modconfComment  start="#" skip="\\$" end="$" contains=modconfTodo

" todo
syn keyword modconfTodo	    FIXME TODO XXX NOTE

" keywords and similar
syn match   modconfBegin    "^" skipwhite nextgroup=modconfCommand,modconfComment

syn match   modconfCommand  "\(add\s\+\)\=(above\|below\|probe\|probeall\}"
syn region  modconfCommand  transparent matchgroup=modconfCommand start="\(add\s\+\)\=options" skip="\\$" end="$" contains=modconfModOpt
syn keyword modconfCommand  define remove keep install insmod_opt else endif
syn keyword modconfCommand  nextgroup=modconfPath skipwhite alias depfile generic_stringfile pcimapfile include isapnpmapfile usbmapfile parportmapfile ieee1394mapfile pnpbiosmapfile persistdir prune
syn match   modconfCommand  "path\(\[\w\+\]\)\=" nextgroup=modconfPath skipwhite
syn region  modconfCommand  transparent matchgroup=modconfCommand start="^\s*\(if\|elseif\)" skip="\\$" end="$" contains=modconfOp
syn region  modconfCommand  transparent matchgroup=modconfCommand start="^\s*\(post\|pre\)-\(install\|remove\)" skip="\\$" end="$"


" expressions and similay
syn match   modconfOp	    contained "\s-[fnk]\>"
syn region  modconfPath	    contained start="\(=\@=\)\=/" skip="\\$" end="\\\@!\_s"
syn match   modconfModOpt   contained "\<\w\+=\@="

if exists("modconf_minlines")
    let b:modconf_minlines = modconf_minlines
else
    let b:modconf_minlines = 50
endif
exec "syn sync minlines=" . b:modconf_minlines

" Define the default highlighting.
" For version 5.7 and earlier: only when not done already
" For version 5.8 and later: only when an item doesn't have highlighting yet
if version >= 508 || !exists("did_modconf_syn_inits")
  if version < 508
    let did_modconf_syn_inits = 1
    command -nargs=+ HiLink hi link <args>
  else
    command -nargs=+ HiLink hi def link <args>
  endif

  HiLink modconfComment Comment
  HiLink modconfTodo	Todo
  HiLink modconfCommand Keyword
  HiLink modconfPath	String
  HiLink modconfOp	Identifier
  HiLink modconfModOpt  Identifier
  delcommand HiLink
endif

let b:current_syntax = "modconf"

" vim: set sts=2 sw=2: