Saturday, March 28, 2009

2html.vim

Ever wanted to post your c code on your web page just as colorful as it looks in your vi editor? Well, I used to do this very often in the past. But then one fine day my (free) web hosting provider vanished and I lost all that. Then I stopped it for a long time. Recently I wanted to post some C codes that way, but could not remember how to do that. It took me 15-20 minutes of google search to get that command. Well its simple:

source $VIMRUNTIME/syntax/2html.vim
When you do this from vi, the window will split into two and one will show the corresponding html code generated (Ok, I hope its understood that this needs to be done when syntax highlighting is enabled). The new file generated will have the name . Save this new html file and you are ready to publish your code in its colorful glory.

No comments: