Add Textpattern mode

Needs some improvements, such as auto code completion, but generally
works OK.