Rough Book

random musings of just another computer nerd

Month: January, 2012

Indenting XML and HTML from vim

vim has an awesome feature, using which you can pipe a range through an external command. This is pretty useful if you’re opening up an un-indented or poorly-indented XML or HTML file. If you want to indent your entire file, simply do the following:

:%!tidy -i -xml -q

The -i option tells tidy that it needs to indent the content, -xml tells tidy that the content is well-formed XML, and -q puts tidy into “quiet mode” where extraneous information is suppressed. You can also specify ranges like so:

:40, 74!tidy -i -xml -q

This indents content between lines 40 and 74 (both lines inclusive). You can also do:

:., .+50!tidy -i -xml -q

This indents the current line and the next 50 lines. You can also do the same for HTML:

:%!tidy -i -xml -q

You can of course, supply additional parameters to tidy to customize the indenting.

:%!tidy -i -q

The Problem With Patents (Infographic)

A few pictures from my vacation to Oman

Here are a few pictures from my vacation to Oman. I only wish I had longer that two weeks! I traveled with my wife, my best friend Michael, as well as my sister and her husband. We visited Nizwa, Muttrah, the Grand Mosque, as well as friends and family. The following pictures were taken with my Nikon D3000. I’ve made minor edits like straightening, or converting images to black and white. Hope you enjoy the pictures!

All original content on these pages is fingerprinted and certified by Digiprove
%d bloggers like this: