Sublime Forum

How in the world do we use code folding?

#1

ST3, with python code.
Code Folding remains a big mystery to me…

I have a few classes, each with a number of methods.
I usually do Ctrl-K Ctrl-2 to fold to these methods. Sometimes it does this, other times it does nothing, sometimes it folds to the Class definition.

It also seems to depend on where the cursor is positioned… I can’t figure out where I should place the cursor, and based on what Ctrl-K Ctrl-2 is intended to do, it doesn’t make sense to me that cursor position should even matter?

Any help on how to use this? It’s so nice when it works!

0 Likes

#2

You might want to look at your Key Bindings file and check what that key combination does and what the fold commands are bound to. Super+n where n is the level to want to fold to is the default binding.

You also should mention the OS you’re running on (Macs have a habit of highjacking command combinations, for instance), the version of ST you’re running and any plugins you’ve got installed.

0 Likes

#3

The key binding is:
{ “keys”: [“ctrl+k”, “ctrl+2”], “command”: “fold_by_level”, “args”: {“level”: 2} },

running Windows 7…

Today, folding a given file is working as expected. 2 days ago, in the same file, it did nothing at all… :-\

0 Likes

#4

possibly related are some existing bug reports:


0 Likes