]> git.madduck.net Git - etc/vim.git/blob - .vim/syntax/puppet.vim

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Write mail backups on write
[etc/vim.git] / .vim / syntax / puppet.vim
1 " puppet syntax file
2 " Filename:     puppet.vim
3 " Language:     puppet configuration file
4 " Maintainer:   Luke Kanies <luke@madstop.com>
5 " URL:         
6 " Last Change:
7 " Version:     
8 "
9
10 " Copied from the cfengine, ruby, and perl syntax files
11 " For version 5.x: Clear all syntax items
12 " For version 6.x: Quit when a syntax file was already loaded
13 if version < 600
14   syntax clear
15 elseif exists("b:current_syntax")
16   finish
17 endif
18
19 syn region  puppetDefine        start="^\s*\(class\|define\|site\|node\)" end="{" contains=puppetDefType,puppetDefName,puppetDefArguments
20 syn keyword puppetDefType       class define site node inherits contained
21 syn keyword puppetInherits      inherits contained
22 syn region  puppetDefArguments  start="(" end=")" contains=puppetArgument
23 syn match   puppetArgument      "\w\+" contained
24 syn match   puppetArgument      "\$\w\+" contained
25 syn match   puppetArgument      "'[^']+'" contained
26 syn match   puppetArgument      '"[^"]+"' contained
27 syn match   puppetDefName     "\w\+" contained
28
29 syn match   puppetInstance           "\w\+\s*{" contains=puppetTypeBrace,puppetTypeName,puppetTypeDefault
30 syn match   puppetTypeBrace       "{" contained
31 syn match   puppetTypeName       "[a-z]\w*" contained
32 syn match   puppetTypeDefault    "[A-Z]\w*" contained
33
34 syn match   puppetParam           "\w\+\s*=>" contains=puppetTypeRArrow,puppetParamName
35 syn match   puppetParamRArrow       "=>" contained
36 syn match   puppetParamName       "\w\+" contained
37 syn match   puppetVariable           "$\w\+"
38 syn match   puppetVariable           "${\w\+}"
39 syn match   puppetParen           "("
40 syn match   puppetParen           ")"
41 syn match   puppetBrace           "{"
42 syn match   puppetBrace           "}"
43
44 syn region  puppetString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=puppetVariable
45
46 syn keyword puppetBoolean    true false
47 syn keyword puppetKeyword    import inherits include
48 syn keyword puppetControl    case default
49
50 " comments last overriding everything else
51 syn match   puppetComment            "\s*#.*$" contains=puppetTodo
52 syn keyword puppetTodo               TODO NOTE FIXME XXX contained
53
54 " Define the default highlighting.
55 " For version 5.7 and earlier: only when not done already
56 " For version 5.8 and later: only when an item doesn't have highlighting yet
57 if version >= 508 || !exists("did_puppet_syn_inits")
58   if version < 508
59     let did_puppet_syn_inits = 1
60     command -nargs=+ HiLink hi link <args>
61   else
62     command -nargs=+ HiLink hi def link <args>
63   endif
64
65   HiLink puppetVariable             Identifier
66   HiLink puppetBoolean              Boolean
67   HiLink puppetType                 Identifier
68   HiLink puppetDefault              Identifier
69   HiLink puppetKeyword              Define
70   HiLink puppetTypeDefs             Define
71   HiLink puppetComment              Comment
72   HiLink puppetString               String
73   HiLink puppetTodo                 Todo
74 "  HiLink puppetBrace                Delimiter
75 "  HiLink puppetTypeBrace            Delimiter
76 "  HiLink puppetParen                Delimiter
77   HiLink puppetDelimiter            Delimiter
78   HiLink puppetControl              Statement
79   HiLink puppetDefType              Define
80   HiLink puppetDefName              Type
81   HiLink puppetTypeName             Statement
82   HiLink puppetTypeDefault          Type
83   HiLink puppetParamName            Identifier
84   HiLink puppetArgument             Identifier
85
86   delcommand HiLink
87 endif
88
89 let b:current_syntax = "puppet"