Writing docu

Ng Pheng Siong ngps at madcap.dyndns.org
Mon Mar 12 16:16:04 CET 2001


I'm writing a programming HOWTO using Vim. ("SSL programming in Python with
M2Crypto", for the curious.)

In the HOWTO, fragments of program code will be scattered thru-out the 
text, e.g.,

    Here's a simple example:

        def hello():
            print 'Hello, world'

    Another example:

        def hello2(there):
            print 'Hello,', there

    We can see that [...]

I want to prefix line numbers to the program code _only_, to facilitate
discussion, like this:

    Here's a simple example:

        1.1     def hello():
        1.2         print 'Hello, world'

    Another example:

        2.1     def hello2(there):
        2.2         print 'Hello,', there

    We can see that [...]

I'm currently using Gnu textutils 'nl' to generate line numbers, but 'nl'
doesn't do dotted numbers such as 1.1, 1.2, ...

What's the easiest way to do this in Vim? With a Python interpreter
embedded? Perl embedded?

What other Vim-compatible docu tools - LaTex, DocBook, whatever - would you
recommend for writing programming guides and manuals?

TIA. Cheers.

Ng Pheng Siong <ngps at post1.com> * http://www.post1.com/home/ngps

More information about the Python-list mailing list