SublimeText3 Fold/Unfold all methods

谁说我不能喝 提交于 2019-12-03 04:17:49

Using the Sublime Text 3 menu, you can find EDIT -> Code Folding -> which exposes the folding methods and will helpfully tell you the default keyboard shortcuts they are assigned to.

By default you press Ctrl+K, then Ctrl+1 to fold all subroutines. Then, to unfold all I would press Ctrl+K then Ctrl+J.

If this does not work for your file type / syntax, try Ctrl+K, Ctrl+2 and above to see if another folding level works for you.

Unfortunately for me, the proprietary code I work with required custom syntax and a custom function written in our in-house package to fold all of our functions (a new sublime command written in python and installed as a package).

More simple

Select the code and press:

Ctrl + Shift + [ to fold

Ctrl + Shift + ] to unfold


Updates

You can also select an element. Exemple:

Open the console (View -> Console or Ctrl`) with a source code file focused and enter the following commands at the bottom:

view.run_command("fold_all")
view.run_command("unfold_all")

to see their effect.

These commands can be bound with custom key bindings or put into the Command Palette for easy use.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!