chore: remove lua heredocs in documentation and readme

This commit is contained in:
kiyan 2022-02-09 21:54:36 +01:00 committed by Stephan Seitz
parent 708b4e4cac
commit 2e67eace75
2 changed files with 8 additions and 38 deletions

View file

@ -100,8 +100,7 @@ Each module provides a distinct tree-sitter-based feature such as [highlighting]
All modules are disabled by default and need to be activated explicitly in your `init.vim`, e.g., via
```vim
lua <<EOF
```lua
require'nvim-treesitter.configs'.setup {
-- One of "all", "maintained" (parsers with maintainers), or a list of languages
ensure_installed = "maintained",
@ -126,7 +125,6 @@ require'nvim-treesitter.configs'.setup {
additional_vim_regex_highlighting = false,
},
}
EOF
```
Each module can also be enabled or disabled interactively through the following commands:
@ -268,8 +266,7 @@ Additional modules can be provided as [external plugins](https://github.com/nvim
Consistent syntax highlighting.
```vim
lua <<EOF
```lua
require'nvim-treesitter.configs'.setup {
highlight = {
enable = true,
@ -284,15 +281,13 @@ require'nvim-treesitter.configs'.setup {
additional_vim_regex_highlighting = false,
},
}
EOF
```
#### Incremental selection
Incremental selection based on the named nodes from the grammar.
```vim
lua <<EOF
```lua
require'nvim-treesitter.configs'.setup {
incremental_selection = {
enable = true,
@ -304,7 +299,6 @@ require'nvim-treesitter.configs'.setup {
},
},
}
EOF
```
#### Indentation
@ -312,14 +306,12 @@ EOF
Indentation based on treesitter for the `=` operator.
**NOTE: This is an experimental feature**.
```vim
lua <<EOF
```lua
require'nvim-treesitter.configs'.setup {
indent = {
enable = true
}
}
EOF
```
#### Folding
@ -343,8 +335,7 @@ If you have a parser that is not on the list of supported languages (either as a
2. Run `tree-sitter generate` in this directory (followed by `tree-sitter test` for good measure).
3. Add the following snippet to your `init.vim`:
```vim
lua <<EOF
```lua
local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
parser_config.zimbu = {
install_info = {
@ -357,16 +348,13 @@ parser_config.zimbu = {
},
filetype = "zu", -- if filetype does not match the parser name
}
EOF
```
If you wish to set a specific parser for a filetype, you should extend the `filetype_to_parsername` table:
```vim
lua <<EOF
```lua
local ft_to_parser = require"nvim-treesitter.parsers".filetype_to_parsername
ft_to_parser.someft = "python" -- the someft filetype will use the python parser and queries.
EOF
```
4. Start `nvim` and `:TSInstall zimbu`.
@ -398,10 +386,8 @@ but if you want to extend a query use the `after/queries/` directory.
If you want to completely override a query, you can use `:h set_query()`.
For example, to override the `injections` queries from `c` with your own:
```vim
lua <<EOF
```lua
require("vim.treesitter.query").set_query("c", "injections", "(comment) @comment")
EOF
```
Note: when using `set_query`, all queries in the runtime directories will be ignored.
@ -416,8 +402,7 @@ If you wish you write your own module, you need to support
At the top level, you can use the `define_modules` function to define one or more modules or module groups:
```vim
lua <<EOF
```lua
require'nvim-treesitter'.define_modules {
my_cool_plugin = {
attach = function(bufnr, lang)
@ -431,7 +416,6 @@ require'nvim-treesitter'.define_modules {
end
}
}
EOF
```
with the following properties:

View file

@ -38,7 +38,6 @@ By default, everything is disabled.
To enable supported features, put this in your `init.vim` file:
>
lua <<EOF
require'nvim-treesitter.configs'.setup {
-- One of "all", "maintained" (parsers with maintainers), or a list of languages
ensure_installed = "maintained",
@ -63,7 +62,6 @@ To enable supported features, put this in your `init.vim` file:
additional_vim_regex_highlighting = false,
},
}
EOF
<
See |nvim-treesitter-modules| for a list of all available modules and its options.
@ -80,14 +78,12 @@ Each module corresponds to an entry in the dictionary passed to the
`nvim-treesitter.configs.setup` function, this should be in your `init.vim` file.
>
lua <<EOF
require'nvim-treesitter.configs'.setup {
-- Modules and its options go here
highlight = { enable = true },
incremental_selection = { enable = true },
textobjects = { enable = true },
}
EOF
<
All modules share some common options, like `enable` and `disable`.
@ -95,14 +91,12 @@ 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.
>
lua <<EOF
require'nvim-treesitter.configs'.setup {
highlight = {
enable = true,
disable = { "cpp", "lua" },
},
}
EOF
<
For more fine-grained control, `disable` can also take a function and
@ -111,7 +105,6 @@ The function is called once when a module starts in a buffer and receives the
language and buffer number as arguments:
>
lua <<EOF
require'nvim-treesitter.configs'.setup {
highlight = {
enable = true,
@ -120,7 +113,6 @@ language and buffer number as arguments:
end,
},
}
EOF
<
Options that define or accept a keymap use the same format you use to define
@ -150,7 +142,6 @@ Supported options:
Defaults to `false`.
>
lua <<EOF
require'nvim-treesitter.configs'.setup {
highlight = {
enable = true,
@ -162,7 +153,6 @@ Supported options:
additional_vim_regex_highlighting = false,
},
}
EOF
<
Note: The api is not stable yet.
@ -186,7 +176,6 @@ Supported options:
Defaults to `grm`.
>
lua <<EOF
require'nvim-treesitter.configs'.setup {
incremental_selection = {
enable = true,
@ -198,7 +187,6 @@ Supported options:
},
},
}
EOF
<
------------------------------------------------------------------------------
@ -212,13 +200,11 @@ Supported options:
- enable: `true` or `false`.
- disable: list of languages.
>
lua <<EOF
require'nvim-treesitter.configs'.setup {
indent = {
enable = true
},
}
EOF
<
==============================================================================
COMMANDS *nvim-treesitter-commands*