Convert code to HTML with Vim

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.

Posted on 7 Mar 2011, 18:10


Posted on 7 Mar 2011, 24:27 by abushcrafter
You don't need Vim...

Posted on 8 Mar 2011, 8:24 by BarryK
Re Highlight
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.

Posted on 8 Mar 2011, 8:49 by BarryK
Re Highlight, more
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.

Posted on 8 Mar 2011, 10:09 by CLAM01
Viva Vi!
adapting to editing with vi or vim (vi improved)is similar to adapting to calculating using reverse Polish notation. Once you adapt your mind to the sequencing of the entry syntax it becomes automatic pretty quickly. With vim it's mostly the switching between editing and entering, and, if you are used to mousing, keyboard-editing. Once you have your fingers used to the basic editing key locations and combinations vim is quick and easy. And the output being all separate parts,it can be fed through just about anything, to produce just about anything.

Posted on 8 Mar 2011, 20:31 by abushcrafter
Thanks for the info.