Configuration for my NixOS based systems and Home Manager
1" Vim syntax file
2" Language: mkfile (used by OS Inferno mk(1))
3" Maintainer: Alex Efros <powerman-asdf@ya.ru>
4" URL: http://powerman.name/download/vim/syntax/mkfile.vim
5" Version: 1.10
6" Last Change: 2012-12-09
7
8if version < 600
9 syntax clear
10elseif exists("b:current_syntax")
11 finish
12endif
13
14
15syn include @ShOs syntax/sh.vim
16unlet b:current_syntax
17syn include @ShInferno syntax/infsh.vim
18unlet b:current_syntax
19
20
21syn match mkfileComment "\\\@<!#.\{-}\(\\\?\n\)\@=" contains=mkfileTodo,@Spell
22syn keyword mkfileTodo contained TODO TBD FIXME XXX NOTE BUG WARNING DEBUG OPTIMIZATION WORKAROUND
23syn match mkfileEscaped "\\."
24syn match mkfileError contained "^\s\+\S.*"
25
26syn match mkfileDelimiter contained "[=:%<|]"
27syn match mkfileNextLine contained "\\\n"
28 \ containedin=mkfileAssignment,mkfileVarWithAttr,mkfileVar,mkfileTargetWithAttr,mkfileTargets
29
30syn match mkfileVarValue contained "\$\w\+"
31syn match mkfileVarValue contained "\${\w\+}"
32syn match mkfileVarValue contained "\${\w\+:[^}]*}" contains=mkfileVarSubst
33syn match mkfileVarSubst contained ":[^}]*" contains=mkfileDelimiter,mkfileVarValue
34syn match mkfileVarDelimiter contained "[${}]"
35 \ containedin=mkfileVarValue
36
37syn region mkfileExternal excludenl keepend start="^<" end="$" contains=mkfileDelimiter,mkfileVarValue
38
39syn region mkfileAssignment excludenl keepend start="^\w\(\w\|\\\n\)*\(\s\|\\\n\)*=" skip="\\\n" end="$"
40 \ contains=mkfileVarWithAttr,mkfileVarValue,mkfileComment,mkfileEscaped
41 \ skipempty nextgroup=mkfileError
42syn match mkfileVarWithAttr contained "^\w\(\w\|\\\n\)*\(\s\|\\\n\)*=\(\(\\\n\)*\(=\|U\(\\\n\)*=\)\)\?"
43 \ contains=mkfileVar,mkfileDelimiter,mkfileVarAttr
44syn match mkfileVar contained "^\(\w\|\\\n\)*\w"
45syn match mkfileVarAttr contained "\(=\(\\\n\)*\)\@<=U\(\(\\\n\)*=\)\@="
46
47syn region mkfileRule excludenl keepend start="^[^ \t#=:]\([^#=:]\|\\\n\)*:" skip="\\\n" end="$"
48 \ contains=mkfileTargetWithAttr,mkfilePrereq,mkfileVarValue,mkfileComment,mkfileEscaped
49 \ skipempty nextgroup=mkfileError,mkfileRecipe
50syn region mkfileRule_os excludenl keepend start="^[^ \t#=:]\([^ \t#=:]\|\\\n\)*-\(os\|sh\):" skip="\\\n" end="$"
51 \ contains=mkfileTargetWithAttr,mkfilePrereq,mkfileVarValue,mkfileComment,mkfileEscaped
52 \ skipempty nextgroup=mkfileError,mkfileRecipe_os
53syn match mkfileTargetWithAttr contained "^[^ \t#=:]\([^#=:]\|\\\n\)*:\(\(\\\n\)*\(:\|[<DENnPQRUV]\+\(\\\n\)*:\)\)\?"
54 \ contains=mkfileTargets,mkfileDelimiter,mkfileTargetAttr
55syn match mkfileTargets contained "^\([^#=:]\|\\\n\)*[^ \t#=:]"
56 \ contains=mkfileDelimiter,mkfileVarValue
57syn match mkfileTargetAttr contained "\(:\(\\\n\)*\)\@<=[<DENnPQRUV]\+\(\(\\\n\)*:\)\@="
58syn match mkfilePrereq contained "\(:\(\\\n\)*\)\@<=.*"
59 \ contains=mkfileDelimiter,mkfileVarValue,mkfileComment,mkfileEscaped
60syn region mkfileRecipe contained excludenl keepend start="^\s.*" skip="\n\s" end="$"
61 \ contains=@ShInferno
62syn region mkfileRecipe_os contained excludenl keepend start="^\s.*" skip="\n\s" end="$"
63 \ contains=@ShOs
64" without including @Sh…:
65" \ contains=mkfileVarValue,mkfileComment,mkfileEscaped
66
67
68if version >= 508 || !exists("did_mkfile_syn_inits")
69 if version < 508
70 let did_mkfile_syn_inits = 1
71 command -nargs=+ HiLink hi link <args>
72 else
73 command -nargs=+ HiLink hi def link <args>
74 endif
75
76 HiLink mkfileError Error
77 HiLink mkfileComment Comment
78 HiLink mkfileTodo Todo
79 HiLink mkfileEscaped Special
80
81 HiLink mkfileDelimiter Operator
82 HiLink mkfileNextLine Special
83
84 HiLink mkfileVarValue Identifier
85 HiLink mkfileVarSubst String
86 HiLink mkfileVarDelimiter Delimiter
87
88 HiLink mkfileVar Identifier
89 HiLink mkfileVarAttr Type
90
91 HiLink mkfileTargets Function
92 HiLink mkfileTargetAttr Type
93
94 delcommand HiLink
95endif
96
97let b:current_syntax = "mkfile"