Editing OpenEmbedded and Bitbake files with syntax highlighting at Vim

Now that I’m currently working with OpenEmbedded at Mamona, I often have to edit and create new ‘bb’ files (the definition and instructions to build packages or define configurations, like ebuilds for Gentoo).

After working with ebuilds to build a few packages, I was really comfortable with the syntax highlighting and new ebuild templates that I have with Vim, but didn’t found anything like that for Bitbake and OpenEmbedded.

First searching for syntax highlighting for Bitbake, I found that Chris Larson already created a Vim syntax file that covered almost everything I need, but was a little bit different from what we have with ebuilds, so I decided to create my own syntax (based on Chris’) and template plugin.

Here’s the code, I just released the version 0.1, it’s quite easy to install, just like any other vim syntax and plugins, just copy the directories at your ~/.vim (sorry emacs users, but this is only for Vim 😉

I’m probably not covering everything from the OpenEmbedded/Bitbake syntax, but it’s quite good for now. If you see any red text around at your code just email me and I’ll try to fix it (patches are also welcome).

It was quite fun to develop for Vim, it’s not that different from any other language and it has many good help files where you can find every allowed syntax that you can use in your script.

Here are some screenshots from bb files and the template plugin:

* Syntax Highlighting:
vim syntax

* Template for new bb files (just open a new file that ends with ‘.bb’):
vim template
The template plugin will try to find your user name and email by your global git conf.

Thanks Chris for his syntax file and for the gentoo developers, who created the gentoo-syntax package.