Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any way to copy a syntax-coloured file in Vim as HTML?

Tags:

vim

I've got a couple of files loaded in Vim, but I wanted to post the contents with the colouring that Vim is providing. Short of print-screen, is there a way to do this? Ideal would be a copy/paste as HTML, but I suspect I'm going to be disappointed.

like image 548
Julian Birch Avatar asked Nov 06 '10 09:11

Julian Birch


2 Answers

You just need to enter the command

:TOhtml
like image 163
Martin Broadhurst Avatar answered Sep 21 '22 19:09

Martin Broadhurst


Alongside with built-in :TOhtml which was already mentioned, you can try my plugin which is more customizable: format.vim. Its advantages over 2html are explained on the plugin page.

like image 23
ZyX Avatar answered Sep 21 '22 19:09

ZyX