Home Download Buy Blog Forum Support

shift-tab to unindent current line?

shift-tab to unindent current line?

Postby oats on Tue Jul 20, 2010 1:36 pm

I would like shift-tab to unindent the current line, even if no text is highlighted. Currently, shift-tab will unindent only after I select at least one full line. I would prefer no selection is required to have shift-tab unindent just the current line.

Reason: I am coding in languages which close if-statements with "end", not brackets, and these "end" are not recognized for auto-unindent. I would like to just type "end" and shift-tab to unindent.

I would prefer this to be the default behavior for Sublime Text (I see no down-side to it), but perhaps I can also do this with a plugin, can someone help me with that?
Thanks
oats
 
Posts: 101
Joined: Mon Nov 09, 2009 4:39 pm

Re: shift-tab to unindent current line?

Postby guillermooo on Tue Jul 20, 2010 3:08 pm

Add this line at the bottom of your User Keybindings (look under the Preferences menu):

Code: Select all
<binding key="shift+tab" command="unindent" />


unindent is a built-in command.

Does that work for you? I don't know whether Jon has left this one out for a good reason, though.
guillermooo
 
Posts: 728
Joined: Thu Jul 23, 2009 9:06 am

Re: shift-tab to unindent current line?

Postby oats on Tue Jul 20, 2010 4:27 pm

Excellent, guillermooo. Your suggestion works perfectly. I guess I would further suggest this be a default behavior. I'm not aware of any reason not to do this-- shift-tab really has no other function?
oats
 
Posts: 101
Joined: Mon Nov 09, 2009 4:39 pm

Re: shift-tab to unindent current line?

Postby Paul on Fri Jul 23, 2010 6:24 pm

I'm working with Ruby in the latest Sublime beta, which closes "if" statements with "end" and no brackets, and it automatically un-indents for me. Maybe it is possible to find the necessary content from the language file and copy it to whichever language file you use.
Paul
 
Posts: 6
Joined: Sun Jul 18, 2010 2:58 am


Return to Ideas and Feature Requests

Who is online

Users browsing this forum: Yahoo [Bot] and 7 guests