Home Download Buy Blog Forum Support

Folding Via Hotkey, rather than Clicking.

Folding Via Hotkey, rather than Clicking.

Postby kuroir on Sat Nov 19, 2011 9:50 pm

Is it possible to fold a block just from placing your cursor over it and hitting a hotkey? (is there a command yet for that?)

Currently I can only do that by clicking on the icon:

Image
kuroir
 
Posts: 71
Joined: Thu Sep 01, 2011 11:28 pm
Location: Mexico

Re: Folding Via Hotkey, rather than Clicking.

Postby C0D312 on Sat Nov 19, 2011 10:05 pm

Go to Edit > Code Folding. It will list all the coding options and keyboard shortcuts.
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: Folding Via Hotkey, rather than Clicking.

Postby kuroir on Sat Nov 19, 2011 11:25 pm

C0D312 wrote:Go to Edit > Code Folding. It will list all the coding options and keyboard shortcuts.


I just tried those, but it won't work unless I select code.

What I want is to actually just fold whatever block the cursor is on.
kuroir
 
Posts: 71
Joined: Thu Sep 01, 2011 11:28 pm
Location: Mexico

Re: Folding Via Hotkey, rather than Clicking.

Postby kuroir on Tue Nov 22, 2011 1:19 am

From the command on the toolbar it still won't work..
Help please? :)
kuroir
 
Posts: 71
Joined: Thu Sep 01, 2011 11:28 pm
Location: Mexico

Re: Folding Via Hotkey, rather than Clicking.

Postby C0D312 on Tue Nov 22, 2011 1:40 am

I guess I'll make a plugin for you...
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: Folding Via Hotkey, rather than Clicking.

Postby jps on Tue Nov 22, 2011 2:04 am

The key bindings listed in the Edit / Code Folding menu will fold the block the caret is on if no text is selected, or if there's a selection, they'll fold the selected text.
jps
Site Admin
 
Posts: 3071
Joined: Wed Mar 19, 2008 12:33 pm

Re: Folding Via Hotkey, rather than Clicking.

Postby kuroir on Tue Nov 22, 2011 2:42 am

jps wrote:The key bindings listed in the Edit / Code Folding menu will fold the block the caret is on if no text is selected, or if there's a selection, they'll fold the selected text.


I can get the second option to work ( select text + folding command )

But the first one is not working, at least not as expected.

I think this is a bug.

I have the following code:

Code: Select all
.pagination {
  @include pagination;
}


I'm expecting that placing the cursor anywhere near those 3 lines and doing fold, will actually fold that given block. However it won't work if I place the cursor anywhere on the first or third line, it'll only work on the second line.

:(
kuroir
 
Posts: 71
Joined: Thu Sep 01, 2011 11:28 pm
Location: Mexico

Re: Folding Via Hotkey, rather than Clicking.

Postby kuroir on Tue Nov 22, 2011 2:48 am

I'm also trying to make the fold / unfold hotkeys work with one single key with a plugin sublimator wrote for me, but it seems it won't work the same way:

import sublime_plugin

Code: Select all
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())
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 17 guests