Sublime Forum

Unindent using shift-tab

#1

Unindent using shift-tab doesn’t seem to work. I upgraded to 2101 from 2099 and am running on windows 7 64-bit because it looked like 2101 had a fix for unindent, but it still didn’t work for me.

Triggering the unindent option from the edit menu works, however.

Also, is there a custom keybinding dialog somewhere, or would I have to add that to a global user-preference file?

0 Likes

#2

In your user file settings add:

"shift_tab_unindent": true

or set “shift_tab_unindent” to true in your default file settings.

0 Likes

#3

Hmmm… tried that in both the global default and user files and that didn’t work. Why wouldn’t that be turned on by default anyway?

0 Likes

#4

By default you have to have a new-line in your selection in order for shift-tab to unindent. This option makes it so that the unindenting happens regardless of whether there’s a new-line in the selection.

0 Likes

#5

I’m not sure that that is a sensible default. Under Edit->Line, Unindent = Shift-Tab. Why should it be context specific (i.e. when there is a new-line in the selection)? If there’s no other function for shift-tab, then disabling it in certain circumstances is counter-intuitive. If I want to unindent a line I would have to hit ctrl-l to select the whole line, then shift-tab to unindent. It’s a whole other key-chord that is unnecessary.

It also violates the law of least surprise. I can’t think of another “smart” editor where shift-tab doesn’t always unindent (no matter where you are in a line).

Besides, setting that option didn’t seem to work. Is there anything else I can try?

0 Likes

#6

Coda? Dreamweaver? And i think Textmate too :smile:

Actually, this behavior is for jumping to previous snippet cursor position (when it need). I think is a reminiscence of the past, because now works ok.

0 Likes

#7

Good points; I haven’t used those much. Not sure if this is a windows vs. mac os convention. Notepad++, Eclipse, and Visual Studio will all unindent with shift-tab at the beginning of a line

I can understand having shift-tab differ depending on context (such as filling in snippet fields), but in plain default mode, I don’t think it makes sense to turn off shift-tab=unindent. Why would you want shift-tab to act the same as tab, especially when the unindent command is listed as being bound to shift-tab in the menu?

Is that not a bug, especially when setting

"shift_tab_unindent": true

doesn’t work?

0 Likes

#8

if that doesn’t work you can add this in your shortcut file and should work:

{ "keys": "shift+tab"], "command": "unindent" }, { "keys": "shift+tab"], "command": "prev_field", "context": { "key": "has_prev_field", "operator": "equal", "operand": true } ]}

0 Likes

#9

Thanks iamntz, that does indeed work. Is there a link for the 2.0 documentation of the key-binding and settings JSON?

0 Likes

#10

where is the “shortcut file”?
thank you

0 Likes

#11

Try this: screencast.com/t/Uhplg7cOYp :smile:

0 Likes

#12

Thank you

0 Likes