Sublime Forum

Back-tab is brain dead when translate_tabs_to_spaces is true

#1

I like Sublime2 enough to purchase a license, but…

I use spaces instead of tabs: “translate_tabs_to_spaces”: true
People that use tab characters instead of spaces, most likely do not use back-tab, they use back-space. I know I never used back-tab until I started using spaces for tabs.

When I press back-tab, Sublime2 does a forward-tab. This is really dumb.
When I tried to fix the problem by using unindent, it then indents everything left of the cursor to the left. This is not a substitute for back-tab.

Forward-tab indents everything right of the cursor to the right.
Back-tab should indent everything right of the cursor to the left by deleting spaces.

Simply put: Back-tab should undo a forward-tab.

Even Microsoft Visual Studio IDE managed to get this right.

Please fix!

0 Likes

#2

By “back-tab”, I am presuming you mean the “shift+tab” key combination.
If you look at menu option Preferences>Key Bindings - Default, you can see that that key combination is used in several different contexts.
This help text explains one of them:
sublimetext.com/docs/2/tab_completion.html , specifically this section:
Inserting Literal Tabs
**To insert a tab rather than a completion, press shift+tab. **

If I use shift+tab when the cursor is anywhere in the whitespace to the left of any code on a line, it indeed works in the desired manner you allude to, in both ST2 and ST3, regardless whether translate_tabs_to_spaces is set to true or false. It just works. Correctly. In both versions.
However, if the cursor is placed anywhere in the code portion of the line, then the context triggers Tab Completion, and shift+tab acts differently in that context.
Now, you do have some options. You can either change the key combination to something more to your liking, or disable tab completion, or you might even discover a better option for your working style.
You might want to spend a bit of time reading the documentation.

0 Likes

#3

Thanks for responding oldwarhorse.

Can you tell me the Sublime command that performs a back-tab when translate_tabs_to_space is true? I’ll happily use this command and map it to something other than shift-tab to side step the heavily overload shift-tab key bindings for now. I hope I’m wrong, but I don’t think it exists. I can tell you the commands that it is not, it’s not “unindent,” “reindent,” or “prev_field.”

Before posting to this form I did in fact read a lot of the documentation and tried a lot of different things. I also saw other people having the same issue on these forums, with no adequate solutions given to the OP. Here is one such example: https://forum.sublimetext.com/t/remove-tab-character-t-on-shift-tab-st2/9595/1

0 Likes