I started developing Google Gadgets for LabPixies, so one of the first thing I looked for was syntax highlighting. Vim recognized the gadgets’ code as XML file (which is correct), but I wanted also HTML syntax highlighting for the HTML part. So after searching a bit for some existing solution, I found one, but I didn’t like as it required me to wrap the HTML code with a specific comment. As I don’t like this kind of solution, I’ve decided to create my own syntax highlighting file for Vim.
Save the following code under
And add the following line to your
au BufRead <google_gadgets> runtime! syntax/google_gadgets.vim
The line you added to the
.vimrc file will automatically load the syntax highlighting for files of type
google_gadgets. While this file type isn’t automatically detected, you can easily set one by typing
Tip: If you want some file to always be detected as
google_gadget add the following modeline to it:
<!-- vim: set filetype=google_gadgets : -->
(you got to have modelines enabled for this to work).
Some things are still missing, such as highlighting for all the keywords and methods of the API, and automatic file type detection. I plan to address those issue as time will permit me. If you think I’ve left out some important functionality that should belong with this code, please comment or contact me.