The Vim User Manual

The Vim User Manual, part of the documentation that comes with Vim 6.1 (see http://vim.sf.net/) is meant to be read as a book. Still it is organised as a multitude of little files, to make for easier reading from within the editor.

When there was a request for a printable version on the vim-dev mailing list, I wrote a Perl program that glues all files together into a big HTML file. This program, and the resulting ready to print HTML-file are available on this page.

A copy of this page, and a PDF version of the Vim manual can be found on the VimDoc page, together with an HTML version of the manual for on-line browsing.

News: I updated the ready-to-download user manual, it now is the version that comes with Vim 6.1.

If you just want to download the ready to print file, you might as well jump directly to the Files section.

How does it work?

The program feeds all the files you give it to Vim, one by one, and then sources 2html.vim which translates it to HTML. Before that, a special colourscheme is selected, called printman.vim, that has simple syntax highlighting using only black and white, and the attributes bold and italic. Thus the HTML created is also limited to these.

The program then reads in the result, stripping off the headers and footers from the individual files, and adds one header and one footer to the output, to create legal HTML.

A little bit of cleaning up is done: the title line ("VIM USER MANUAL - by Bram Moolenaar") and the copyright line ("Copyright: see ...") are stripped from the individual files, since the don't need to be repeated for each chapter. Also the lines reading "Next chapter", "Previous chapter" and "Table of contents" are removed, since they are a navigation aid only.

How to use it

SYNTAX

usr2html.pl <files>
    
The files to give as a command line parameter are the user manual help files, called usr_01.txt to usr_90.txt and usr_toc.txt. They will be processed in the order they appear on the command line. A sensible command line would be:
usr2html.pl usr_toc.txt usr_01.txt usr_02.txt usr_03.txt usr_04.txt usr_05.txt usr_06.txt usr_07.txt usr_08.txt usr_09.txt usr_10.txt usr_11.txt usr_12.txt usr_20.txt usr_21.txt usr_22.txt usr_23.txt usr_24.txt usr_25.txt usr_26.txt usr_27.txt usr_28.txt usr_29.txt usr_30.txt usr_31.txt usr_40.txt usr_41.txt usr_42.txt usr_43.txt usr_44.txt usr_45.txt usr_90.txt
All on one line, without the linebreaks you see here.
One thing the program needs to know is where your copy of Vim is; and due to the nature of the start command, on Windows this needs to point to the real gvim.exe. Before running the program, edit the file and change the value of $vimcmd somewhere near the top.

The files

The Vim2html program

usr2html.pl is derived from Sirtaj Singh Kang's vim2html.pl, that used to be part of the Vim distribution. It was that program that I adapted to use Vim to do the formatting in the first place. Then I started expanding it to add more links in the text than only from words in |-signs, but I forgot about that project later and accidently lost the source.

I recreated it, using some more knowledge of Perl and some Copious Free Time, and the result can be found here.

This version of vim2html.pl is slow, but it gets the job done; and it has an advantage over the awk script that does the same thing: it uses the current colour scheme in Vim, so you can create HTML with your own trusted highlight colours.

How to use it

SYNTAX

vim2html.pl <tags> <file>
    
The tags file is the one that comes with your Vim help files, the file is one of those help files. An HTML version of that file will be created with .html as extension instead of .txt. The Makefile for making the documentation for Vim knows all about this, since an older version of vim2html.pl is already included in the source distribution of Vim.
This program also needs to know is where your copy of Vim is; and due to the nature of the start command, on Windows this needs to point to the real gvim.exe. Before running the program, edit the file and change the value of $vimcmd somewhere near the top.

The files

Epilogue

If you have any questions, comments or improvements on these programs, please let me know. These programs are released as Charityware, just as Vim is; please read :help copyright in Vim. All terms stated therein for Vim apply 'mutatis mutandis' for usr2html.pl and vim2html.pl.


Dion Nicolaas
dion@nicolaas.net