Skip to content

Commit 451736d

Browse files
Britt Selvitellevim-scripts
Britt Selvitelle
authored andcommitted
Version 0.1: Initial upload
0 parents  commit 451736d

File tree

3 files changed

+95
-0
lines changed

3 files changed

+95
-0
lines changed

README

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
This is a mirror of http://www.vim.org/scripts/script.php?script_id=2094
2+
3+
Syntax highlighting for Puppet, http://reductivelabs.com/trac/puppet, the distributed configuration management system. Based on the initial work by Luke Kanies.
4+
5+

ftdetect/puppet.vim

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
au BufRead,BufNewFile *.pp setfiletype puppet

syntax/puppet.vim

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
" puppet syntax file
2+
" Filename: puppet.vim
3+
" Language: puppet configuration file
4+
" Maintainer: Luke Kanies <[email protected]>
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"

0 commit comments

Comments
 (0)