Speed up HTML markup in Netbeans with Zen Coding

My friend Derek shared a link about Zen Coding a month ago which I finally made time to look at this morning. Zen Coding is a plugin designed to supercharge your HTML markup and CSS coding and it's available for several IDEs and text editors. I watched the available screencasts and gave it a try this morning. It's remarkable what you can do with it.

Although the NetBeans version of Zen Coding doesn't provide CSS support and is missing many of the HTML features available in other versions of the plugin, it's still worth an install. Alexander Makarov created the NetBeans version of the plugin and provides basic instructions in Russian. After translating the instructions and a bit of trial and error, I was able to get the basics workings. Here's how to install and use it for NetBeans for OS X.

Install

  1. Download NetBeans Zen HTML, version 1.2 at the writing of this post.
  2. Move the downloaded package to your .netbeans directory and unpack. Replace the 6.8 directories in the commands below to match your NetBeans version.

    % mv NetBeans.Zen.HTML.1.2.zip ~/.netbeans/6.8
    % cd ~/.netbeans/6.8
    % unzip NetBeans.Zen.HTML.1.2.zip

Use

NetBeans already provides HTML tag completion for individual opening and closing tags.

Native NetBeans HTML tag autocomplete

Zen Coding inserts both the opening and closing tags with a keystroke. The tab key triggers Zen Coding's HTML autocomplete magic by inserting both the opening and closing tags. Note the standard NetBeans red box targets to enter text or attribute values. Use the tab key to move between the boxes and hit enter when you're done with an entry.

Basic zen-coding NetBeans example

Inserting anchors and their URLs is a breeze.

Insert anchor zen-coding NetBeans example

Markup existing text quickly, just select and hit ctrl+Enter or Return.

Markup existing text blocks with zen-coding for Netbeans

You can also insert class, id, and style attributes with the
following keystrokes:

  • ctrl+2 = class
  • ctrl+3 = id
  • ctrl+4
    = style

Insert attributes with zen-coding for Netbeans

Note that attribute insertion is a bit quirky. I found it easier to insert a tag, hit the tab key, position my cursor in
the opening tag (i.e. <tag|>), and then insert the attribute.

I highly recommend this plugin. The Netbeans version only implements a portion of what the plugin is capable of in other editors. I'm going to give it a whirl with Textmate next!

 

 

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <codeblock> <blockquote> <h1> <h2> <h3> <h4> <h5> <img>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. PHP source code can also be enclosed in <?php ... ?> or <% ... %>.
  • You may link to webpages through the weblinks registry
  • Twitter-style @usersnames are linked to their Twitter account pages.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
copyright © 2009, 2 tablespoons