|
82 | 82 |
|
83 | 83 | The following are the functions provided by `ts-fold-mode` |
84 | 84 |
|
85 | | -| Commands | Description | |
86 | | -| -------------------------- | --------------------------------------------------------------------------- | |
87 | | -| `ts-fold-close` | fold the current syntax node. | |
88 | | -| `ts-fold-open` | open all folds inside the current syntax node. | |
89 | | -| `ts-fold-open-recursively` | open the outmost fold of the current syntax node. Keep the sub-folds close. | |
90 | | -| `ts-fold-close-all` | close all foldable syntax nodes in the current buffer. | |
91 | | -| `ts-fold-open-all` | open all folded syntax nodes in the current buffer. | |
92 | | -| `ts-fold-toggle` | toggle the syntax node at `point'. | |
| 85 | +Commands for enabling `ts-fold`: |
| 86 | + |
| 87 | +| Commands | Description | |
| 88 | +| -------------------------------- | --------------------------------------------------------------------------------------------------- | |
| 89 | +| `ts-fold-mode` | enable `ts-fold-mode` in the current buffer. | |
| 90 | +| `global-ts-fold-mode` | enable `ts-fold-mode` whenever tree-sitter is turned on and the major mode is supported by ts-fold. | |
| 91 | +| `ts-fold-indicators-mode` | enable ts-fold with indicators in the current buffer. See [plugins section](#-indicators-mode). | |
| 92 | +| `global-ts-fold-indicators-mode` | enable ts-fold with indicators globally. See [plugins section](#-indicators-mode). | |
| 93 | + |
| 94 | +Commands for using `ts-fold`. |
| 95 | + |
| 96 | +| Commands | Description | |
| 97 | +| -------------------------- | ----------------------------------------------------------------------------- | |
| 98 | +| `ts-fold-close` | fold the current syntax node. | |
| 99 | +| `ts-fold-open` | open the outermost fold of the current syntax node. Keep the sub-folds close. | |
| 100 | +| `ts-fold-open-recursively` | open all folds inside the current syntax node. | |
| 101 | +| `ts-fold-close-all` | close all foldable syntax nodes in the current buffer. | |
| 102 | +| `ts-fold-open-all` | open all folded syntax nodes in the current buffer. | |
| 103 | +| `ts-fold-toggle` | toggle the syntax node at `point'. | |
| 104 | + |
| 105 | +If evil mode is loaded, then these commands are also added to the evil folding list. |
93 | 106 |
|
94 | 107 | ### 🔨 Supported languages |
95 | 108 |
|
@@ -340,7 +353,7 @@ basic `ts-fold-range-seq`. |
340 | 353 | ts-fold comes with a couple of useful little additions that can be used or |
341 | 354 | turned off as desired. |
342 | 355 |
|
343 | | -### ⚖️ Indicators Mode |
| 356 | +### ⚖ Indicators Mode |
344 | 357 |
|
345 | 358 | <p align="center"> |
346 | 359 | <img src="./etc/indicators.png" width="40%" height=480%"/> |
@@ -376,19 +389,28 @@ explicitly declare the package in in your config. |
376 | 389 |
|
377 | 390 | #### 🖥 Usage |
378 | 391 |
|
379 | | -You can then enable this manually by doing the following |
| 392 | +You can then enable this manually by doing either of the following: |
380 | 393 |
|
381 | 394 | ``` |
382 | 395 | M-x ts-fold-indicators-mode |
| 396 | +
|
| 397 | +M-x global-ts-fold-indicators-mode |
383 | 398 | ``` |
384 | 399 |
|
385 | 400 | Please note that turning on `ts-fold-indicators-mode` automatically turns on |
386 | | -`ts-fold-mode` as well. |
| 401 | +`ts-fold-mode` as well. Though, turning off `ts-fold-indicators-mode` does not |
| 402 | +turn off `ts-fold-mode` |
| 403 | +
|
| 404 | +- To enable this automatically whenever `tree-sitter-mode` is enabled, use the global indicator mode: |
| 405 | +
|
| 406 | + ```elisp |
| 407 | + (global-ts-fold-indicators-mode 1) |
| 408 | + ``` |
387 | 409 |
|
388 | | -- To enable this automatically whenever `tree-sitter-mode` is enabled: |
| 410 | + Else, a hook can be added to tree-sitter directly. |
389 | 411 |
|
390 | 412 | ```elisp |
391 | | - (add-hook 'tree-sitter-after-on-hook #ts-fold-indicators-mode) |
| 413 | + (add-hook 'tree-sitter-after-on-hook #'ts-fold-indictors-mode) |
392 | 414 | ``` |
393 | 415 |
|
394 | 416 | - To switch to left/right fringe: (Default is `left-fringe`) |
|
0 commit comments