Vim: Save highlighted syntax in HTML

By automatthias

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.

7 Responses to “Vim: Save highlighted syntax in HTML”

  1. lenina Says:

    Vim is cool :P

  2. paul Says:

    this sounds very intresting, and i’m going to have a go with it tomorrow. :-D

  3. shakov Says:

    Perfect, thank you.

  4. franz Says:

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

  5. Save Vim syntax highlighting to HTML « life(”CS”); Says:

    [...] standard yet appreciable feature. So after some googling around I came across a solution posted by Maciej Bliziński which saves the syntax highlighted source code you would view inside vim as good old HTML. The [...]

  6. Vim: Turn code into HTML | rubyconsumer Says:

    [...] on his blog talks about an interesting feature in [...]

  7. jack Says:

    Nice tip!

    Yet another way to do it:

    http://codesnippets.joyent.com/posts/show/2073

Leave a Reply