zen-coding for gedit

I’ve just discovered a sweet project called zen-coding (hat tip to Roger Johannson). It’s a plugin for your editor, and if you write a lot of HTML it’s great. Basically, it takes a typed-in: div#name.one.two and expands it to <div id="name" class="one two"></div> It can handle all sorts of complicated constructs; essentially, you type what amounts to a CSS selector and then hit Ctrl+E and it expands that into HTML. It can handle some really complex stuff. For example, cc:ie6>p+blockquote#sample$.so.many.classes*2 expands to \<!—[if lte IE 6]> \<p>\</p> \<blockquote id=”sample1” class=”so many classes”>\</blockquote> \<blockquote id=”sample2” class=”so many classes”>\</blockquote> \<![endif]—> For more detail on how it all works, see the zen-coding site itself and Christopher’s Zen Coding writeup at Monday by Noon. One other genuinely neat thing about it is that they’re trying quite hard to support lots of editors. Currently they have plugins for TextMate, Aptana, Coda, NetBeans, and Espresso, with IntelliJ IDEA and ScitE in the pipeline. Me, I use gedit, so I did a basic port of the plugin to gedit. You can browse the code, or, if you want to use it, run svn export --force http://svn.kryogenix.org/svn/zen-coding-gedit $HOME/.gnome2/gedit/plugins on the command line. (You’ll then need to enable the plugin, in Edit > Preferences > Plugins.) The install process isn’t easier because I don’t want to be distributing this; I want to get it upstream into the zen-coding tree. My gedit plugin is very basic; in particular, it doesn’t handle placeholders. Placeholders are possible — the gedit snippets plugin, a work of genius, does them, so it ought to be possible to hack them in — but I didn’t have time for that. If anyone wants to pick up the code and make that happen, just say the word.

More in the discussion (powered by webmentions)

  • (no mentions, yet.)