Tab indent line



I was wondering if anyone can tell me how to change the behavior of the tab key. I’m used to the behavior in emacs where hitting the tab key at any position in the line causes the line to be indented to the right indent level according to the language being edited. How can I achieve this? I saw a previous post where the suggestion was to bind tab to editor:indent-selected-rows – this is not quite right as this always indents the line (adds a indent level) rather than automatically indent to the right level (i.e., if the line isn’t already correctly indented, it will adjust the indentation properly). Also, bonus points if after indenting the line to the right level I can get the cursor to go to the beginning of the text if the tab was hit anywhere before that position or just stays put if tab was hit anywhere after the position as this is the emacs behavior.



Unless you can find a package that emulates Emacs tab behavior, this would take some hacking to implement a new command that accomplishes all of these things. If you’re up for that, I can guide you.