Wednesday, September 2, 2009

Highlighting YAML in gedit

I've just written a language spec for YAML so that gedit can highlight it. gedit uses gtksourceview so the highlighting will be available on any application uses the same widget.

Get the latest version from Subversion repository:
svn checkout http://masood.googlecode.com/svn/trunk/yaml-language-spec
or download a tarball from here. Check out the links below if you are also interested in writing a highlighting specification for another language. Links: Language Definition v2.0 Tutorial Language Definition v2.0 Reference

22 comments:

  1. Get this into upstream

    ReplyDelete
  2. I see you use a different font from the default one. Can you tell me its name?

    ReplyDelete
  3. It is Monaco font which I found on Ankit Modi's blog at http://blog.mayfounder.net/2009/02/10/adding-a-new-ttf-font-to-linux/

    I only used it for the screenshot as the font doesn't seem to be monospace.

    ReplyDelete
  4. Monaco does not offer a "bold" variant, so the bold is faked by the operating system, making the letters wider. If your editor uses bold for syntax highlighting, Monaco will appear not monospaced. (Use DejaVu Sans Mono, has a much larger Unicode range and all variants.)

    ReplyDelete
  5. I've found that you highlighting schema doesn't supports multiple spaces after ':' for map definitions.
    I think I fixed this. Can I suggest to include this fix into your code?

    ReplyDelete
  6. Ivan,
    Please email me your patch (my email address is included in file). I would be very happy to include it.

    ReplyDelete
  7. Masood,
    I've emailed you a fixed file. Check your inbox (or spam folder :)

    Thanx

    ReplyDelete
  8. Thank you so much. This is going to be very useful to me.

    ReplyDelete
  9. Great stuff! Any chance of it getting upstream?

    ReplyDelete
  10. Thanks, been looking for this :)

    ReplyDelete
  11. Thanks! Was looking for something like this!

    ReplyDelete
  12. Note: since 3rd Gnome is out here the 'yaml.lang' should be placed in '/usr/share/gtksourceview-3.0/language-specs' (local path should be with 3.0 too).

    I think it would be resonable to update slightly README file. :)

    Thanks for definition! :)

    ReplyDelete
  13. Ignacio De La MadridApril 29, 2011 at 4:00 AM

    Thanks a lot man! I had been looking for this :)

    ReplyDelete
  14. Thanks. As many before me, I found this very useful.

    ReplyDelete
  15. Thank you for this!

    ReplyDelete
  16. Thanks everyone for their support. Unfortunately, I haven't had updated the code (or this blog) for a long time. I'll try to polish it a bit and submit it to upstream so it'll be available easily to everyone.

    ReplyDelete
  17. Thank you so much for yaml.lang!
    Hint for users of medit (mooedit): copy this file to /usr/share/medit-1/language-specs/

    ReplyDelete
  18. I'm using linux mint and this worked flawlessly. Thanks for including the readme-- the instructions in there helped a lot. I'm working on a ruby on rails application and as you might be aware, rails uses Yaml--this is great so I can see highlighting now while coding out my schemas. Thanks!

    ReplyDelete