diff options
| author | patrick96 <p.ziegler96@gmail.com> | 2021-11-13 12:55:21 +0100 |
|---|---|---|
| committer | Stephan Seitz <stephan.seitz@fau.de> | 2021-11-28 00:31:02 +0100 |
| commit | be1c93f848bb57d4392068c708db25e72247615e (patch) | |
| tree | 679897a98c92929e80b067069b0909bf8fd6f075 /doc | |
| parent | zig: work around for hang neovim (diff) | |
| download | nvim-treesitter-be1c93f848bb57d4392068c708db25e72247615e.tar nvim-treesitter-be1c93f848bb57d4392068c708db25e72247615e.tar.gz nvim-treesitter-be1c93f848bb57d4392068c708db25e72247615e.tar.bz2 nvim-treesitter-be1c93f848bb57d4392068c708db25e72247615e.tar.lz nvim-treesitter-be1c93f848bb57d4392068c708db25e72247615e.tar.xz nvim-treesitter-be1c93f848bb57d4392068c708db25e72247615e.tar.zst nvim-treesitter-be1c93f848bb57d4392068c708db25e72247615e.zip | |
Add documentation for cond setting
Ref: #1994
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/nvim-treesitter.txt | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/doc/nvim-treesitter.txt b/doc/nvim-treesitter.txt index 5e758513d..a55f50f7e 100644 --- a/doc/nvim-treesitter.txt +++ b/doc/nvim-treesitter.txt @@ -74,9 +74,13 @@ Each module corresponds to an entry in the dictionary passed to the EOF < -All modules share some common options, like `enable` and `disable`. +All modules share some common options, like `enable`, `disable`, and `cond`. When `enable` is `true` this will enable the module for all supported languages, if you want to disable the module for some languages you can pass a list to the `disable` option. +For more fine-grained control, `cond` takes a function and whenever it returns +`false` the module is disabled for that buffer. +The `cond` function is called once when a module starts in a buffer and +received the language and the buffer number as arguments. > lua <<EOF @@ -84,6 +88,9 @@ if you want to disable the module for some languages you can pass a list to the highlight = { enable = true, disable = { "cpp", "lua" }, + cond = function(lang, bufnr) -- Disable in large C++ buffers + return not (lang == "cpp" and api.nvim_buf_line_count(bufnr) > 50000) + end, }, } EOF |
