From c035fb9f5d2a5d9809cd11f83df6593a2a25ee8f Mon Sep 17 00:00:00 2001 From: Thomas Vigouroux Date: Mon, 25 May 2020 10:29:18 +0200 Subject: docs: document folding --- README.md | 2 +- doc/nvim-treesitter.txt | 12 ++++++++++++ doc/tags | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e87bc2adb..48e9e0de8 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,7 @@ The goal of `nvim-treesitter` is both to provide a simple and easy way to use th but also to add some functionalities to it: Some of these features are : - [x] Incremental selection - - [ ] Syntax based code folding + - [x] Syntax based code folding (`set foldmethod=expr foldexpr=nvim_treesitter#foldexr()`) - [x] Consistent syntax highlighting (the api is not quite stable yet) - [x] Statusline indicator (`require'nvim-treesitter'.statusline(size)`) diff --git a/doc/nvim-treesitter.txt b/doc/nvim-treesitter.txt index 564d9ee88..85bcbddd9 100644 --- a/doc/nvim-treesitter.txt +++ b/doc/nvim-treesitter.txt @@ -165,4 +165,16 @@ could be used as a statusline indicator. Note: The `size` argument is optionnal. When specified, the string will not be longer than `size`. +|nvim_treesitter#foldexpr()| + *nvim_treesitter#foldexpr()* + +Functions to be used to determine the fold level at a given line number. +To use it: > + set foldmethod=expr + set foldexpr=nvim_treesitter#foldexr() +< +Note: This is highly experimental, and folding can break on some types of + edits. If you encounter such breakage, hiting `zx` should fix folding. + In any case, feel free to open an issue with the reproducing steps. + vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/doc/tags b/doc/tags index e58f0d658..0a12b18d5 100644 --- a/doc/tags +++ b/doc/tags @@ -11,6 +11,7 @@ nvim-treesitter-commands nvim-treesitter.txt /*nvim-treesitter-commands* nvim-treesitter-functions nvim-treesitter.txt /*nvim-treesitter-functions* nvim-treesitter-intro nvim-treesitter.txt /*nvim-treesitter-intro* nvim-treesitter-quickstart nvim-treesitter.txt /*nvim-treesitter-quickstart* +nvim_treesitter#foldexpr() nvim-treesitter.txt /*nvim_treesitter#foldexpr()* nvim_treesitter#statusline() nvim-treesitter.txt /*nvim_treesitter#statusline()* ts_api.containing_scope nvim-treesitter.txt /*ts_api.containing_scope* ts_api.get_named_children nvim-treesitter.txt /*ts_api.get_named_children* -- cgit v1.2.3-70-g09d2