--- runtime/filetype.vim	2007-07-11 00:17:13.000000000 +0200
+++ /Applications/_Nico/MacVim.app/Contents/Resources/vim/runtime/filetype.vim	2007-12-01 23:52:23.000000000 +0100
@@ -346,12 +346,26 @@
   au BufNewFile,BufRead *.cxx,*.c++,*.hh,*.hxx,*.hpp,*.moc,*.tcc,*.inl setf cpp
 endif
 
-" .h files can be C, Ch or C++, set c_syntax_for_h if you want C,
-" ch_syntax_for_h if you want Ch.
-au BufNewFile,BufRead *.h
-	\ if exists("c_syntax_for_h") | setf c |
-	\ elseif exists("ch_syntax_for_h") | setf ch |
-	\ else | setf cpp | endif
+" .h files can be C, Ch C++, ObjC or ObjC++. Set c_syntax_for_h if you want C,
+" ch_syntax_for_h if you want Ch. ObjC is detected automatically.
+au BufNewFile,BufRead *.h call s:Check_Header()
+
+func! s:Check_Header()
+  let lines = getline(1, min([line("$"), 200]))
+  if match(lines, '@interface\|@end') > -1
+    setf objc
+  else
+	if exists("c_syntax_for_h")
+      setf c
+	elseif exists("ch_syntax_for_h")
+      setf ch
+	else
+      setf cpp
+    endif
+  endif
+endfunc
+
+
 
 " Ch (CHscript)
 au BufNewFile,BufRead *.chf			setf ch
