sponsor Vim development Vim logo go to HTTPS page Vim Book Ad

buf2html.vim : beta** - generate HTML/XHTML+CSS from a Vim buffer

 script karma  Rating 12/3, Downloaded by 767    Comments, bugs, improvements  Vim wiki

created by
Sören Andersen
script type
This is the next evolution of the script formerly known as "code2html.vim" and before that "2html.vim" (the latter being still a part of the standard Vim release runtime collection). See http://www.vim.org/scripts/script.php?script_id=330.

This is considered beta-quality code at this time.

Accomplished goals (so far) for this release include:

  * Let it produce correct output for all option variants including with/out-line-numbering, with/out-using-css, etc.

* Try to create an HTML comment line that records the SHA1 sum for the buffer data input. Could be useful in future scenarios.

* Clean up the markup so that interstitial spaces in code (not being purposely verbose here, I don't know what else to call them right now) between highlighted identifiers is *not* marked up with redundant default bg/fg color specifiers. This is a huge weakness of the original script.

* Create a visible symbolic (and easily understood) markup in the output when the source is a Makefile, to display where each TAB (ascii \011) was.

Left to do is more debugging; at least 1 known bug exists in that an occasional character will disappear from the output ;-(. And optimization.  And restoring the functionality that was once working in the script in its previous incarnation as code2html.vim, working out a list of system-installed mono fonts and including those in the CSS style declaration.

This script was developed to meet the author's needs. It might not meet yours. If you can improve on it without clobbering the author's needs, however, your patches are welcome. In any event, the customary legalese-ish disclaimer about "FITNESS FOR ANY PURPOSE" applies.

The result of running this script on itself can be viewed at http://intrepid.perlmonk.org/apropos.vim/buf2html/current/myself.html

As always, credit to Bram Moolenaar and David Nečas (Yeti) for the original script and Christian Hujer for his later contribution.
install details
Installation is left to the user to decide upon. This being a script, not a plugin, it can be saved in any convenient directory. The author favors ~/scripts on his accounts. It's always called by  :source'ing it anyhow.

Note well: like its predecessor scripts, this script only really works well when used with the GUI variant of Vim (gVim).

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
buf2html.zip 2.0b2 2008-10-18 7.0 Sören Andersen May have fixed the character-eating problem ;-/. Lacking time right now to check many different files.
buf2html.zip 2.0b1 2008-09-27 7.0 Sören Andersen Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
SourceForge.net Logo