Home Download Buy Blog Forum Support

Dev Build 2115

Dev Build 2115

Postby bradgessler on Fri Sep 09, 2011 8:03 pm

These keyboard shortcuts break convention with naving between tabs on Mac OS X:

* Fold command is now bound to Command+Shift+[ on OS X, and Ctrl+Shift+[ on Windows and Linux
* Unfold command is bound to Command+Shift+] on OS X, and Ctrl+Shift+] on Windows and Linux

Maybe Cmd + Shift + > and Cmd + Shift + < is a better shortcut for collapsing code?
bradgessler
 
Posts: 10
Joined: Wed Jul 27, 2011 6:39 pm

Re: Dev Build 2115

Postby kuroir on Fri Sep 09, 2011 10:45 pm

I suggest that we use function keys for these kind of actions since they're going to be intensively used:

On TextMate you use F1 to Open and to Close Folds. You can use Super + Alt + [1..0] to close different levels of indentation. 0 being "Fold all", and 1 being "fold first level".

Just leaving this out there since it's something that works.

Edit: I see that super+alt+[1..X] are used to handle the splitting windows, which is ok. However F1 is a good folding option.
kuroir
 
Posts: 71
Joined: Thu Sep 01, 2011 11:28 pm
Location: Mexico

Re: Dev Build 2115

Postby jps on Fri Sep 09, 2011 11:03 pm

It's not my week this week, will change for the next build.
jps
Site Admin
 
Posts: 3062
Joined: Wed Mar 19, 2008 12:33 pm

Re: Dev Build 2115

Postby ajpalkovic on Fri Sep 09, 2011 11:30 pm

Any week that you add code folding is your week :)
ajpalkovic
 
Posts: 142
Joined: Fri Jun 10, 2011 10:21 pm

Re: Dev Build 2115

Postby alexrussell on Sat Sep 10, 2011 12:54 pm

kuroir wrote:I suggest that we use function keys for these kind of actions since they're going to be intensively used:

On TextMate you use F1 to Open and to Close Folds. You can use Super + Alt + [1..0] to close different levels of indentation. 0 being "Fold all", and 1 being "fold first level".

Just leaving this out there since it's something that works.

Edit: I see that super+alt+[1..X] are used to handle the splitting windows, which is ok. However F1 is a good folding option.


I used to love Notepad++'s code folding whereby you could (like TextMate) fold to given levels of a source file, but its shortcuts were alt+1, alt+2, alt+3 and I think shift+alt+1, etc. for unfold. (Which I know in ST2 are currently select tab and select layout respectively.) All I'd say is try to avoid the F keys if possible, because on some keyboards (e.g., my MacBook Pro) they have dual functions, and I'd hate to be pressing Fn every time I want to do an operation in ST2 I use with relative regularity.

Also, as the code folding idea is taken forward (as I'm sure it will be) it's be great to have gutter fold markers like most IDEs do. Would be nice to 'visually' fold rather than have to make a selection.

Finally, am I doing something wrong for folding? The only folding I can get to work is tag attribute folding with ctrl+k, ctrl+t. The ctrl+shift+[ and ctrl_shift_] don't appear to work for me, but maybe I'm using it incorrectly. Neither placing the caret next to a bracket nor selecting text invokes the function.
alexrussell
 
Posts: 74
Joined: Fri Jul 15, 2011 9:06 am

Re: Dev Build 2115

Postby kuroir on Sun Sep 11, 2011 1:59 am

I hope that the key F1 is the one that it's going to be used to Fold/Unfold. If not, I hope there's a way for users to set it by themselves:

Any ideas on how to do it currently?
kuroir
 
Posts: 71
Joined: Thu Sep 01, 2011 11:28 pm
Location: Mexico

Re: Dev Build 2115

Postby kuroir on Sun Sep 11, 2011 10:52 am

sublimator wrote:@kuroir

Code: Select all
import sublime_plugin

class ToggleFold(sublime_plugin.TextCommand):
    '{"keys": ["f1"], "command": "toggle_fold"}'
    def run(self, edit):
        view = self.view

        if any(not view.fold(sel) for sel in view.sel()):
            map(view.unfold, view.sel())


Change `any` to `all` and wrap the generator expression in a list to taste.


Thanks, this is going to be really useful! :) right now I'm working on a way for TextMate users to switch to ST2 easily and still be able to go back to TextMate whenever they want.
kuroir
 
Posts: 71
Joined: Thu Sep 01, 2011 11:28 pm
Location: Mexico


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 36 guests