[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: vim's syntax highlighting + typedefs from #include <foo.h>



Lo, on Tuesday, January 2, markm@student.unsw.edu.au did write:

> Hi,
> 
> Is it possible to get vim to have a look through your #included files
> and colour the defined types? In particular, it would be nice to have
> 'gfloat' coloured similar to 'float', when including glib.h

As another poster mentioned, it's probably quite easy to add new types to
vim's syntax lists, but that's not quite what you wanted.

The behavior you describe is, I think, the Right Thing.  However, it
requires a full C/C++ parser, which is very complex---C and especially C++
aren't context-free.  I'm an emacs user myself, so I can't speak as to vi's
implementation, but I suspect that it uses regexps and string matching,
rather than a full parser to do syntax highlighting, just like emacs.  If
that is in fact the case, then no, there's no way to do it.  (Short of
implementing a full C++ parser, of course.)

Richard



Reply to: