2 " Language: Objective C
3 " Maintainer: Valentino Kyriakides <1kyriaki@informatik.uni-hamburg.de>
4 " Last Change: 2001 May 09
6 " For version 5.x: Clear all syntax items
7 " For version 6.x: Quit when a syntax file was already loaded
10 elseif exists("b:current_syntax")
14 " Read the C syntax to start with
16 source <sfile>:p:h/c.vim
21 " Objective C extentions follow below
23 " NOTE: Objective C is abbreviated to ObjC/objc
24 " and uses *.h, *.m as file extensions!
27 " ObjC keywords, types, type qualifiers etc.
28 syn keyword objcStatement self super _cmd
29 syn keyword objcType id Class SEL IMP BOOL nil Nil
30 syn keyword objcTypeModifier bycopy in out inout oneway
32 " Match the ObjC #import directive (like C's #include)
33 syn region objcImported contained start=+"+ skip=+\\\\\|\\"+ end=+"+
34 syn match objcImported contained "<[^>]*>"
35 syn match objcImport "^#\s*import\>\s*["<]" contains=objcImported
37 " Match the important ObjC directives
38 syn match objcScopeDecl "@public\|@private\|@protected"
39 syn match objcDirective "@interface\|@implementation"
40 syn match objcDirective "@class\|@end\|@defs"
41 syn match objcDirective "@encode\|@protocol\|@selector"
43 " Match the ObjC method types
45 " NOTE: here I match only the indicators, this looks
46 " much nicer and reduces cluttering color highlightings.
47 " However, if you prefer full method declaration matching
48 " append .* at the end of the next two patterns!
50 syn match objcInstMethod "^[\t\s]*-[\s]*"
51 syn match objcFactMethod "^[\t\s]*+[\s]*"
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_objc_syntax_inits")
59 let did_objc_syntax_inits = 1
60 command -nargs=+ HiLink hi link <args>
62 command -nargs=+ HiLink hi def link <args>
65 HiLink objcImport Include
66 HiLink objcImported cString
68 HiLink objcScopeDecl Statement
69 HiLink objcInstMethod Function
70 HiLink objcFactMethod Function
71 HiLink objcStatement Statement
72 HiLink objcDirective Statement
77 let b:current_syntax = "objc"