2007-11-23

doctest from Vim

I want to become comfortable with the Vim way of editing, I'm convinced it will save me much time, since I seem to be on a path which involves lots of keyboarding.

A new member of the zcadoc project recently pointed out that Baiju's choice for an example application has the potential to be confusing. It's a hotel app, which handles guest registrations. The ZCA involves registering components, so the word is used in 2 ways.

Maybe we can change the spelling of a couple terms to avoid the confusion.

So.

izca.txt holds the book in ReStructured text, with the examples in doctest format.

I need to do text replacements, running doctest on the results to see what broke. This seems like a common enough use case to take the time to study how to do it efficiently. I can picture a Vim expert making the changes, running the tests, tweaking the changes ... all from the keyboard, using few keystrokes.

All that's required to run the doctests in the book is::

import doctest; doctest.testfile('izca.txt')

I made a file ``dtbook`` in the book directory::

#!/usr/bin/python
import doctest
doctest.docfile('izca.txt')

now, if I enter the following while in Vim normal mode::

:r! ./dtbook

The file tests run, and any tracebacks are pasted into the file.
I can do {lineno}G to jump to each problem line, delete the tracebacks
when finished.

Next, start renaming.

No comments: