Nico Weber wrote:

> Attached is a patch to filetype.vim that adds objc detection for .h  
> files. I don't know if this is of general interest, but I think so.

I wonder how often the detection will fail.  "@interface" and "@end"
could appear in a comment of a C or C++ file, at least.  Esp. when using
something like doxygen.

Is there any way to make it a bit more specific?

The check could be turned into a one liner:

" .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:FTheader()

func! s:FTheader()
  if match(getline(1, min([line("$"), 200])), '@interface\|@end') > -1
    setf objc
  elseif exists("c_syntax_for_h")
    setf c
  elseif exists("ch_syntax_for_h")
    setf ch
  else
    setf cpp
  endif
endfunc


-- 
hundred-and-one symptoms of being an internet addict:
169. You hire a housekeeper for your home page.

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui