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.

9 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

  8. Bozo McFarlane Says:

    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?)

  9. Jacek Nakonieczny Says:

    Legen-dary command, i just added map to this in my virc. Thanks:)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.