Vim: Save highlighted syntax in HTML

Vim is able to highlight syntax of a very large number of languages. It also has a nice feature, allowing you to save the highlighted source to a HTML file.

:runtime! syntax/2html.vim

After typing this command, you’ll get a split window with your source in HTML. You can now save it to a file.


Author: automatthias

You won't believe what a skeptic I am.

10 thoughts on “Vim: Save highlighted syntax in HTML”

  1. Great, thanks! A programmer’s day without vim is just unconceivable

  2. It’s funny how some “senior developers” insist that you need to install the entire Visual Basic development suite to save syntax highlighting as HTML. Thank you for this tip.

    (One thing I’ve always wondered. If there were no poor children in Uganda, would VIM exist?)

Comments are closed.

%d bloggers like this: