Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

adding vim syntax stuff

git-svn-id: https://reductivelabs.com/svn/puppet/trunk@875 980ebf18-57e1-0310-9a29-db15c13687c0
  • Loading branch information...
commit 2577c865ea72861e7a9d6445a8880af6c37b54a4 0 parents
authored February 07, 2006

Showing 2 changed files with 96 additions and 0 deletions. Show diff stats Hide diff stats

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

0 notes on commit 2577c86

Please sign in to comment.
Something went wrong with that request. Please try again.