[CentralOH] Unittesting with vi(m)

Mark Erbaugh mark at microenh.com
Tue Nov 1 22:01:15 CET 2011


So I'm using Test Driven Development. I have vim open with two side by side windows. One window has the code under test, the other the unit tests. I have a code runner under the if __name__ == '__main__': section of the unit test file.  I can quickly run my unit tests by switching to that window (ctrl-W W) and doing :! python %.

I think it would be smoother if I could execute python with the unit test file regardless of which window is active.  Of course I could specify the path to the unittest file, but that's awkward. The next best solution would be to create a quick map (which is what I'll probably do if I don't come up with something better).

But I wonder if there is a way to specify a file by buffer number as the argument to :! python instead of % (for the current buffer)?

Thanks,
Mark


More information about the CentralOH mailing list