3

I would like to request enabling the Tab key to insert 4 spaces, just like Ctrl+K does, but for multiple levels of code. That would make it a lot easier to write small bits of code when needed, without having to press Space 4 times for each line of code for proper indentation.

I am aware there are also SO users who use the Tab key for navigation, to make it easier to submit the question by tabbing to the submit button, so I understand it is not added as a global feature. It would be nice to be able to enable it in the preferences though.

The features I'd like to request when this option is enabled would be:

  • inserting 4 spaces when pressing Tab
  • inserting the same amount of whitespace as the current line when pressing Enter
    • unless the current line only contains whitespace
  • removing 4 spaces behind the caret when pressing Shift+Tab
  • the same functionality as Ctrl+K when pressing tab on highlighted areas, except indentation will only increase
    • same as above, but for Shift+Tab where indentation will only decrease
  • backspace will remove up to 4 spaces when the caret is at the start of the line (same as Shift+Tab when at the start of the line)
  • and optionally:
    • pressing Home moves the caret in front of the first non-whitespace character on that line
    • pressing Home again will toggle between the actual start of the line, and the first non-whitespace character on the line

I hope I'm not the only one who would like to be able to press Tab to indent code, like I do in editors. Also, since this is an opt-in feature, it wouldn't change anything about the current interface, so I think there is no harm in adding this.

5
  • 1
    @FrédéricHamidi I wasn't aware that existed, but there is one difference: he's requesting it site-wide and I'm requesting it as a preferences option. Also, I don't really get it. What's the exact reason this is unnecessary? Copying it to another editor would be more effort than adding in a script once, and making that available for further use? Using a seperate editor seems like an unnecessary step, when tab indentation alone would make this editbox much easier to work with already.
    – Joeytje50
    Commented Oct 7, 2014 at 19:38
  • I did notice the opt-in difference, that's why I chose a duplicate going along the "not needed and available elsewhere" axis instead of the "heresy! a11y!" one. My own opinion is that if you want "advanced" code formatting features, you can use an "advanced" editor (you have one open, as a programmer, right? :), then copy-paste. I'm also not a fan of extending the editor's <textarea> with that kind of features, especially if that means random selection and navigation issues (yes, I'm looking at you, jsFiddle). Commented Oct 7, 2014 at 19:45
  • @FrédéricHamidi oh wow yes jsfiddle is a horrible editor. And of course I have an advanced text editor, but it just seems like an unnecessary extra step, for those who don't mind giving up tab-navigation. Usually tab indentation is all I really need when writing short bits of code.
    – Joeytje50
    Commented Oct 7, 2014 at 19:50
  • thanks, that I dont have to ask the question. And what is wrong with asking for 'getting better'? the comments/answers here and the possible duplicate question sound like "why should we use something else than vi, its the best"
    – halfbit
    Commented Jan 4, 2015 at 0:42
  • one more, I would even be happy if nothing happen if I press <TAB>, insead of finding myself anywhere
    – halfbit
    Commented Jan 4, 2015 at 0:43

0

Browse other questions tagged .