Wednesday, September 2, 2009

vimdiff export to html

I couldn't determine if this was discussed before by searching. I want
to export the current vimdiff to html, but 2html.vim only exports on
window at a time. Is there a plugin or a trick to come up with both
the windows participating in the diff?

I was able to get a reasonable result by manually merging the body of
the two html files generated into an outer table, but I had an issue
the table wrapping some lines due to lack of width and take the files
out of sync. To workaround, I had to fix the table width's to be large
enough and avoid the wrap. I couldn't find a way to disable wrapping
all together or set automatically based on the longest lines, may be
this is one of those wacky javascript problems to solve. Here is the
template that I came up with (the background color here reflects my
current colorscheme).

<!--HTML template for side by side diff:-->

<html>
<head>
<title>diff</title>
<meta name="Generator" content="Vim/7.2">
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#333333" text="#ffffff"><font face="monospace">
<table border="1" width="1600">
<tr>
<td width="700" valign="top">
<!-- First file goes here -->
</td>
<td valign="top">
<!-- Second file goes here -->
</td>
</tr>
</table>
</font>
</body>
</html>

<!--
vim: ft=html
-->

It would be nice to automate this merge. If I end up doing this over
and over, I might cook up a macro/plugin but would love to get ideas
from here.

PS: Make sure you set g:html_whole_filler before running 2html.vim,
otherwise the columns won't sync up.

--
HTH,
Hari

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

No comments: