Fold Bash functions (Sublime Text)

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen

In Sublime Text, you can collapse (fold) all code blocks, including indented code blocks and functions in Bash with a built-in keyboard shortcut. On Linux:

Ctrl-k Ctrl-1

Collapse Individual Blocks

  • Place the cursor inside a function { ... } block
  • Press Ctrl + Shift + [ to fold the block
  • Press Ctrl + Shift + ] to unfold it

Customizing Folding Behavior

  • Preferences > Settings
  • Modify "fold_buttons": true (if not already enabled) to make fold markers visible
  • Consider using RegEx-based folding rules by installing the RegEx Fold plugin.