Keybind在Sublime中折叠函数或类?

时间:2017-01-10 01:11:17

标签: sublimetext3 key-bindings

是否有键绑定按下功能或类之前出现的小折叠箭头?

enter image description here

3 个答案:

答案 0 :(得分:2)

转到EDIT>代码折叠。它将显示Sublime Text的所有命令。

答案 1 :(得分:2)

我不认为有。你可以做的是:

def my_func():
     # put your cursor wherever you want on a line that has this level of indentation (here 1)
    """my doc"""
    print('this is') # you can put it here
    print('some code that is going to') # or here
    print('folded!')
    if nb % 2 == 0:
        print('this is an even number') # but not here!

ctrl+shift+[。它会自动选择缩进(这是你的功能的内容),并将其折叠起来。

答案 2 :(得分:0)

与@ math2001的答案类似,ctrl+shift+l将折叠一个类或函数

仅当光标位于要折叠的凹口下方时,此功能才起作用。

即。您要折叠功能B,光标必须在功能B的大括号上方或下方的一行上

functionA() {
    functionB() { //I will fold under A. Don't fold here
        //Fold me
        functionC() { //Fold me
        } //Fold me
    } //Fold me
}