Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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 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.