fast docbook editing in vim

I'm going to write quite a big text in DocBook format. At work I use FrameMaker, but at home I don't have FM, so I'll use the universal text editor vim. DocBook is very verbose format, and it is very unefficient to edit DocBook texts without assistance from a editor. I've looked for how vim can help me and found a life changing solution.

At first, I tried to find an existing solution. Search over gave me these scripts:

I found the first script useful and installed it. The second script didn't work well and I uninstalled it. I didn't try the third script because I didn't want to. Why? Both dbhelper and docbkhelper help to insert DocBook tags, but it's too little help for me.

I prefer the WiKi approach. I like to write the plain text with little formatting hints. A program processes the plain text and generates HTML. Writing become very easy. Why not to use the same approach for writing DocBook?

Fortunately, people have already worked on it. The program wt2db converts WikiText documents into DocBook XML/SGML.

Installing wt2db is a trivial task. Then I added to my .vimrc:

map <F3> <Esc>:'<,'>!wt2db<CR>

Now I can select a WikiText fragment in vim, press F3, and get the fragment have been converted to DocBook. Very nice!

20 July 2005, update

Private installation of the scripts. After unpacking, say (probably it's not required):

$ perl Makefile.PL
$ make

Then copy files to create:

* ~/bin/wt2db-0.5/wt2db
* ~/bin/wt2db-0.5/lib/

And create the wrapper ~/bin/wt2db:


perl -I/home/olpa/bin/wt2db-0.5/lib "$@" /home/olpa/bin/wt2db-0.5/wt2db
Categories: vim