Add tabcompletion support

Add proper tabcompletion support. Most work is code cleanup and adding unittests.
These tests are pretty neat, but they don't belong into `00-load.t`. Rename this file.