Please do not make tab key insert an actual tab!
Many users (well, at least this one) rely on the tab key to change focus when they are not using their mouse. It would break a fundamental UI feature that's been around in data entry forms (on and off the web) since at least Windows 3.1.
I'd suggest to use spaces if you are entering code in the editor. If you have an unusually large block of code, you're probably copy/pasting from an IDE anyway.
If you still want to break tab behavior, there's a StackApp for thatthere's a StackApp for that.