Sublime Forum

Increase and decrease indentation (Shift+Tab)

#1

Hello,

I have a question about Increase and decrease indentation in middle of line or middle of block code. I mean Tab and Shift+Tab functionallity.

For example, i have situation like this:

Then, i push Tab couple times and i have this:

This is ok! BUT now i would like to make a unindent with Shift+Tab (like in N++) but Sublime still add more tabs.

I tried turn on “shift_tab_unindent”: true but when i did that and when i click shift+tab , nothing happen?

What i did wrong?

0 Likes

#2

You don’t do anything wrong. Indention just means a certain amount of whitespace at the beginning of a line, while you are trying to add/remove whitespace in the middle of the text.

If you call TAB with the caret at the bol, ST calls indent function, while hitting TAB in the middle of a text just adds \t. This is visually the same in most cases. SHIFT+TAB calls unindent, which removes the whitespace from the bol. As your lines are not indented nothing happens.

2 Likes

#3

Does backspace work?

0 Likes

#4

yes, working

0 Likes

#5

thanks for explanation

0 Likes

#6

cool tip:

shift+tab is really useful when you select multiple lines.
lets say i have 10 lines of code, and i want to indent all of them, you don’t have to use multi-cursor, you can just select the lines, and press tab, or shift-tab to unindent.

0 Likes

#7

from the settings file:
// By default, shift+tab will only unindent if the selection spans
// multiple lines. When pressing shift+tab at other times, it’ll insert a
// tab character - this allows tabs to be inserted when tab_completion is
// enabled. Set this to true to make shift+tab always unindent, instead of
// inserting tabs.
“shift_tab_unindent”: false,

1 Like