From 8214b90df1346ea4433e4593da86ca44686c376e Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Thu, 24 Mar 2011 10:39:15 -0400 Subject: [PATCH] Add gob2 syntax highlighting rules. --- ftplugin/gob.vim | 26 ++++++++++++++ syntax/gob.vim | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ vimrc | 1 + 3 files changed, 118 insertions(+) create mode 100644 ftplugin/gob.vim create mode 100644 syntax/gob.vim diff --git a/ftplugin/gob.vim b/ftplugin/gob.vim new file mode 100644 index 0000000..92919a3 --- /dev/null +++ b/ftplugin/gob.vim @@ -0,0 +1,26 @@ +" Vim filetype plugin file +" Language: GObject Builder (gob) +" Maintainer: Ding-Yi Chen +" 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 = + \ '\:\:\:\:\:\' + " 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 index 0000000..f3da401 --- /dev/null +++ b/syntax/gob.vim @@ -0,0 +1,91 @@ +" Vim syntax file +" Language: GObject Builder (gob) +" Maintainer: Ding-Yi Chen +" 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 :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 + else + command -nargs=+ HiLink hi def link + 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 57b4021..40de099 100644 --- 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 -- 2.43.2