]> git.draconx.ca Git - vimconf.git/commitdiff
Add gob2 syntax highlighting rules.
authorNick Bowler <nbowler@elliptictech.com>
Thu, 24 Mar 2011 14:39:15 +0000 (10:39 -0400)
committerNick Bowler <nbowler@elliptictech.com>
Thu, 24 Mar 2011 14:39:15 +0000 (10:39 -0400)
ftplugin/gob.vim [new file with mode: 0644]
syntax/gob.vim [new file with mode: 0644]
vimrc

diff --git a/ftplugin/gob.vim b/ftplugin/gob.vim
new file mode 100644 (file)
index 0000000..92919a3
--- /dev/null
@@ -0,0 +1,26 @@
+" Vim filetype plugin file
+" Language:     GObject Builder (gob)
+" Maintainer:  Ding-Yi Chen <dchen at redhat.com>
+" Modified from cpp.vim
+" Last Change:  2008 Feb 21
+
+
+" Only do this when not done yet for this buffer
+if exists("b:did_ftplugin")
+  finish
+endif
+
+" Behaves just like C
+runtime! ftplugin/c.vim ftplugin/c_*.vim ftplugin/c/*.vim
+
+" Let the matchit plugin know what items can be matched.
+
+runtime! macros/matchit.vim
+if exists("loaded_matchit")
+    let b:match_ignorecase = 0
+    let b:match_words =
+                \ '\<public\>:\<protected\>:\<private\>:\<signal\>:\<virtual\>:\<override\>'
+    " Ignore ":syntax region" commands, the 'end' argument clobbers if-endif
+    let b:match_skip = 'getline(".") =~ "^\\s*sy\\%[ntax]\\s\\+region" ||
+                \ synIDattr(synID(line("."),col("."),1),"name") =~? "comment\\|string"'
+endif
diff --git a/syntax/gob.vim b/syntax/gob.vim
new file mode 100644 (file)
index 0000000..f3da401
--- /dev/null
@@ -0,0 +1,91 @@
+" Vim syntax file
+" Language:     GObject Builder (gob)
+" Maintainer:  Ding-Yi Chen <dchen@redhat.com>
+" Modified from cpp.vim
+" Last Change:  2008 Feb 08
+
+if version < 600
+  syntax clear
+elseif exists("b:current_syntax")
+  finish
+endif
+
+" Read the C syntax to start with
+if version < 600
+  so <sfile>:p:h/c.vim
+else
+  runtime! syntax/c.vim
+  unlet b:current_syntax
+endif
+
+
+" GOBject Builder extentions
+syn keyword gobClass           class
+syn keyword gobSelf            self
+syn keyword gobAccess          public protected private
+syn keyword gobClassDeclare    abstract from interface
+syn keyword gobCBlockKeyword   alltop headertop privateheader h a
+syn match gobCBlockStart /%\(alltop{\|headertop{\|privateheader{\|h{\|a{\|{\)/
+syn match gobCBlockEnd        /%}/
+syn keyword gobArguCondition   check type
+syn keyword gobDataDeclare     classwide
+syn keyword gobDataOperation   destroy destroywith unref unrefwith
+syn keyword gobDataOperationMacro VAR VAL
+syn keyword gobDataProperty    nick blurb default_value minimum maximum enum_type flag_type object_type boxed_type param_type link export
+syn keyword gobDataPropertyFunc        property get set
+syn keyword gobDataPropertyType        INT LONG FLOAT DOUBLE CHAR GUNICHAR BOOLEAN ENUM FLAGS STRING OBJECT BOXED POINTER PARAM
+syn keyword gobDataType                flags error
+
+syn keyword gobReturn          onerror defreturn
+syn keyword gobInitMethod      init class_init GET_NEW
+syn keyword gobParentMethod    PARENT_HANDLER
+syn keyword gobMethodModifier  signal virtual override
+
+syn keyword gobSelfReference   SELF IS_SELF SELF_CLASS
+
+syn keyword gobVersion         requires GOB_VERSION_MAJOR GOB_VERSION_MINOR and GOB_VERSION_PATCHLEVEL
+syn keyword gobSupported       BonoboObject GladeXML
+syn keyword gobBoolean         TRUE FALSE
+syn keyword gobConstant                null
+
+" Default highlighting
+if version >= 508 || !exists("did_gob_syntax_inits")
+  if version < 508
+    let did_gob_syntax_inits = 1
+    command -nargs=+ HiLink hi link <args>
+  else
+    command -nargs=+ HiLink hi def link <args>
+  endif
+  HiLink gobClass              Structure
+  HiLink gobSelf               Typedef
+  HiLink gobAccess             Statement
+  HiLink gobClassDeclare       Statement
+  HiLink gobCBlockStart                Include
+  HiLink gobCBlockEnd          Include
+  HiLink gobArguContition      Statement
+  HiLink gobDataDeclare                Statement
+  HiLink gobDataOperation      Statement
+  HiLink gobDataOperationMacro Macro
+  HiLink gobDataProperty       Macro
+  HiLink gobDataPropertyFunc   Function
+  HiLink gobDataPropertyType   Type
+  HiLink gobDataType           Type
+
+  HiLink gobReturn             Statement
+  HiLink gobInitMethod         Function
+  HiLink gobParentMethod       Function
+  HiLink gobMethodModifier     Statement
+
+  HiLink gobSelfReference      Macro
+
+  HiLink gobVersion            Include
+  HiLink gobSupported          Typedef
+  HiLink gobBoolean            Boolean
+  HiLink gobConstant           Constant
+
+  delcommand HiLink
+endif
+
+let b:current_syntax = "gob"
+
+" vim: ts=8
diff --git a/vimrc b/vimrc
index 57b40215c95f1516010bc8197589d776fc1bc5ee..40de099820961b86d5bd57f5d37d88c773c49287 100644 (file)
--- a/vimrc
+++ b/vimrc
@@ -24,6 +24,7 @@ au BufNewFile,BufRead *.cls    set filetype=tex
 au BufNewFile,BufRead *.sig    set filetype=sml
 au BufNewFile,BufRead *.cabal  set filetype=cabal
 au BufNewFile,BufRead *.h      set filetype=c
+au BufNewFile,BufRead *.gob    set filetype=gob
 au BufNewFile,BufRead Makefile.inc set filetype=automake
 
 au BufReadPre .skk-uim-jisyo set fileencodings=euc-jp