I think requiring the user to enter their "matrix" format in the text document in order to format the selected text is a bit odd. You should consider using the input panel via the sublimetext API: show_input_panel
. The API can be found here http://www.sublimetext.com/docs/2/api_reference.html
. I didn't try out but a few simple cases, but it seems like it would be better to have the user select the text they want to "matrixify" and when they execute the command show the input panel so they can specify the format.