11

In the editor it'd be really nice if the tab key is trapped with JavaScript and is transferred to 4 space or similar so when I try to indent my code I can do it with one key. We have the code button but once that is applied it'd be nice to be able to style/indent the internal blocks easily.

(Hope that's not duplicate but even if it's it shows the need of such functionality)

2
  • 3
    @ChrisF the difference is I don't want to convert pasted TABs rather want to be able to press TAB while editing and that get translated to 4 spaces so the link you've posted is not quite relevant.
    – infinity
    Commented Nov 10, 2012 at 11:40
  • I've posted a related discussion.
    – J.Todd
    Commented Jun 25, 2014 at 0:06

1 Answer 1

16

No. Very much no.

The Tab key's behavior is very well-defined in a browser: It tabs you out of the editor box. Going with your feature request would mean killing functionality that everybody expects from their browser. This is not going to happen.

I have created a user script offering the kind of functionality you want (check it out if you're a user script kind of person), and even there I added a way to go back to native tab behavior.

As you'll notice, that way is somewhat awkward. There really isn't a way to make Tab behave in both ways simultaneously, since they obviously contradict each other.

The "press and release Ctrl before pressing Tab" hack (or something along those lines) is okay for someone consciously making the decision to install a user script. But not for the core functionality of a website.

3
  • An alternative would be replace the {} with indent and unindent buttons, though I realise that might be quite a 'radical' change...
    – Benjol
    Commented Jan 24, 2013 at 6:14
  • 2
    Why not make it a user preference, off by default?
    – Zev Spitz
    Commented Apr 2, 2017 at 5:22
  • Yes, very much yes, please.
    – Jason C
    Commented Feb 22, 2022 at 17:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .