Permalink
Browse files

Highlight gyp

  • Loading branch information...
1 parent 04fb2a3 commit efa784ef525dc37cb01bb9915a52bcc13f0e6912 @seejohnrun committed Jun 6, 2012
Showing with 111 additions and 0 deletions.
  1. +2 −0 .vim/ftdetect/gyp.vim
  2. +28 −0 .vim/ftplugin/gyp.vim
  3. +17 −0 .vim/indent/gyp.vim
  4. +64 −0 .vim/syntax/gyp.vim
View
@@ -0,0 +1,2 @@
+autocmd BufNewFile,BufRead *.gyp,*.gypi setf gyp
+
View
@@ -0,0 +1,28 @@
+" Vim filetype plugin file
+" Language: Gyp
+" Maintainer: Kelan Champagne (http://yeahrightkeller.com)
+" URL: https://github.com/kelan/gyp.vim
+
+if exists("b:did_ftplugin")
+ finish
+endif
+let b:did_ftplugin = 1
+
+set ts=2
+set sw=2
+set tw=0
+set wm=0
+
+set expandtab
+
+" Set 'formatoptions' to break comment lines but not other lines,
+" and insert the comment leader when hitting <CR> or using "o".
+setlocal formatoptions-=t formatoptions+=croql
+
+" Set 'comments' to format dashed lists in comments.
+setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
+
+setlocal commentstring=#%s
+
+let b:undo_ftplugin = "setl fo< ofu< com< cms<"
+
View
@@ -0,0 +1,17 @@
+" Vim indent file
+" Language: Gyp
+" Maintainer: Kelan Champagne (http://yeahrightkeller.com)
+" URL: https://github.com/kelan/gyp.vim
+
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+ finish
+endif
+let b:did_indent = 1
+
+" C indenting is not too bad.
+setlocal cindent
+setlocal cinoptions+=j1,J1
+
+let b:undo_indent = "setl cin<"
+
View
@@ -0,0 +1,64 @@
+" Vim syntax file
+" Language: Gyp
+" Maintainer: Kelan Champagne (http://yeahrightkeller.com)
+" URL: https://github.com/kelan/gyp.vim
+
+if version < 600
+ syntax clear
+elseif exists("b:current_syntax")
+ finish
+endif
+
+
+syn keyword gypCommentTodo TODO FIXME XXX TBD contained
+syn match gypLineComment "#.*" contains=@Spell,gypCommentTodo
+
+syn region gypStringS start=+'+ end=+'\|$+ contains=gypSection,gypTargetSection
+syn match gypNumber "-\=\<\d\+L\=\>\|0[xX][0-9a-fA-F]\+\>"
+
+syn keyword gypSection variables includes targets conditions target_defaults
+syn keyword gypTargetSection actions all_dependent_settings configurations defines dependencies direct_dependent_settings include_dirs libraries link_settings sources target_conditions target_name type msvs_props xcode_config_file xcode_framework_dirs mac_bundle_resources xcode_settings
+
+if exists("gyp_fold")
+ syn match gypFunction "\<function\>"
+ syn region gypFunctionFold start="\<function\>.*[^};]$" end="^\z1}.*$" transparent fold keepend
+
+ syn sync match gypSync grouphere gypFunctionFold "\<function\>"
+ syn sync match gypSync grouphere NONE "^}"
+
+ setlocal foldmethod=syntax
+ setlocal foldtext=getline(v:foldstart)
+else
+ syn keyword gypFunction function
+ syn match gypBraces "[{}\[\]]"
+ syn match gypParens "[()]"
+endif
+
+syn sync fromstart
+syn sync maxlines=100
+
+" 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_gyp_syn_inits")
+ if version < 508
+ let did_gyp_syn_inits = 1
+ command -nargs=+ HiLink hi link <args>
+ else
+ command -nargs=+ HiLink hi def link <args>
+ endif
+ HiLink gypComment Comment
+ HiLink gypLineComment Comment
+ HiLink gypCommentTodo Todo
+ HiLink gypNumber gypValue
+ HiLink gypStringS String
+
+ HiLink gypSection Special
+ HiLink gypTargetSection Conditional
+
+ delcommand HiLink
+endif
+
+let b:current_syntax = "gyp"
+
+

0 comments on commit efa784e

Please sign in to comment.