Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a vim open on code, and the code is highlighted. I would like to write this code to a file, including the color codes used to highlight the text. How can I achieve this ?

share|improve this question

1 Answer 1

up vote 8 down vote accepted

Vim's TOHtml achieves this. It saves the active buffer with the syntax coloring as HTML. It might be included in your Vim installation, so try ahead issuing :TOhtml.

share|improve this answer
This is the most badass thing I've ever seen. +1 million –  Stefano Borini Nov 18 '10 at 10:26
Really awesome.. +1 billion –  SS-3.1415926535897932384626433 Mar 4 '12 at 7:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.