site  contact  subhomenews

Convert code to HTML with Vim

March 07, 2011 — BarryK
I have only ever use vi for the most elementary editing, and even that I found painful. Have never used Vim before. However, I have managed to setup Vim with a nice GTK GUI menu and I am finding it quite usable.

I want to use Vim for one feature only, it's ability to convert code to color-highlighted HTML. This is great for writing documentation -- I want to do some more work on my BaCon tutorials.

I have downloaded 'bacon.vim' to add syntax highligting for BaCon code:

However, I ran into a problem, bacon.vim wasn't recognised. I posted on the BaCon forum and Peter replied almost immediately with a solution:

This is fantastic. I will see if I can get this together into a Vim PET package, all setup to use the nice GTK GUI and recognise BaCon code. Of course, the code-to-HTML feature is applicable to other code such as C and Vala.


You don't need Vim...

Re Highlight
Username: BarryK
"I considered Highlight. It needs the Boost library to compile, which I was too lazy to do. It also needs Qt for a GUI, which can be done -- from the question posted at that link, it seems that Dingo compiled the CLI version only -- that's fine too. Highlight does not have a color syntax file for BaCon, so some work would be required to create that. I presume it would have a Qbasic highlighter that could be adapted.

Re Highlight, more
Username: BarryK
"I just tested Dingo's Highlight in Wary, it works fine. I counted them, Highlight supports 150 languages, Vim supports 534 languages. Highlight 2.14 only supports one variant of Basic, Visual Basic. Dingo has compiled Highlight version 2.14, the latest is 3.3.

Tags: puppy