Keybind在Sublime中折叠函数或类?

问题描述 投票:2回答:3

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

enter image description here

sublimetext3 key-bindings
3个回答
2
投票

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


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+[。它将自动选择缩进(因此您的函数的内容),并将其折叠起来。


0
投票

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

仅当光标位于要折叠的缩进下方时才有效。

IE浏览器。你想折叠functionB,光标必须在functionB的括号上方或下方的一行上

functionA() {
    functionB() { //I will fold under A. Don't fold here
        //Fold me
        functionC() { //Fold me
        } //Fold me
    } //Fold me
}
© www.soinside.com 2019 - 2024. All rights reserved.