Kaz'hack

To content | To menu | To search

Sunday, December 2 2012

Still there

Wow, the last year just flew by! Time for a quick status update.

First of all, I’m not working on the editor back-end any more. I joined the Firefox OS dev team last January and I mostly work on the Gaia front-end. It’s been heart-breaking to stop working on the editor, which is the reason why I started contributing to Mozilla in 2006… but I have to confess I feel much more useful in the Gaia team, and I’m proud to be part of such an amazing project!

Sad corollary: like you would expect for such projects, the work pace is very high and I haven’t been able to work significantly on any other FLOSS project. The first official Firefox OS release is scheduled for mid-January 2013, so don’t expect any update on Kompozer or timesheets.js until the end of the winter. :-/

Among the cool things we do with Firefox OS, I’m the proud developer of webL10n, a client-side i18n/localization JS library. This library is used by all Gaia apps and by other cool projects like PDF.js or Etherpad Lite. We’re ironing webL10n at the moment and we’re trying to optimize its performances, so expect a first public release soon. :-)

Last, I’m organizing monthly French-speaking Vim meet-ups in the Paris office. It was supposed to be an experiment but it’s been working out surprisingly well since March! If you use Vim, speak French and are in Paris next Thursday, ping me. :-)

Thursday, August 11 2011

Vim Syntax Highlighting for Mozilla C++ Files

I’ve tweaked the cpp.vim file that comes with Vim 7.3 to highlight most Mozilla-specific keywords when working on the editor core. A lot of Mozilla-specific types and that can be added manually but the task gets bigger when it comes to nsI* interfaces or NS_* macros…

Most nsI* interfaces can be grabbed with find/grep/sed:

find src/mozilla -regex ".*\.\(idl\|h\)" -exec grep "^\(class\|interface\)\s*nsI" '{}' \; | sed 's/\(:\|;\|,\|{\).*$//' | sed 's/^.*nsI/nsI/' | sed 's/\s*$//' | sort -u

same thing for NS_ERROR* / NS_IMPL* macros and constants:

find src/mozilla -regex ".*\.\(idl\|h\)" -exec grep "^#define\s*NS_ERROR" '{}' \; | sed 's/^#define\s*//' | sed 's/\s.*$//' | sed 's/(.*$//' | sort -u
find src/mozilla -regex ".*\.\(idl\|h\)" -exec grep "^#define\s*NS_IMPL" '{}' \; | sed 's/^#define\s*//' | sed 's/\s.*$//' | sed 's/(.*$//' | sort -u

Here’s the resulting cpp.vim file including the ~900 Mozilla-specific lines (ouch!). Copy it to your ~/.vim/syntax/ directory and voilà, your C++ files should be much more colorful.

Now it’d be really great if:

  • we had omni-completion for the nsI* interfaces instead of just the keywords;
  • we had a similar file (keywords + omni-completion) for JavaScript — mostly for the DOM API
  • this file could be generated automatically — say, with DXR;
  • this file could be included in the Mozilla tree (e.g. a .vimrc file in the top source dir).

To all Vim fanboys among the Mozilla community: I’d love to get your input about that. Maybe we could start a “vim-moz-syntax” project on github or something?

EDIT: (2013-05-19)

  • this work is now available on github: https://github.com/mozfr/mozilla.vim
  • there’s been an article about this in Russian: http://softdroid.net/Vim-Syntax-Highlighting