···2222## Requirements
23232424* **Neovim 0.9** or newer
2525-* [`nvim-treesitter`](https://github.com/nvim-treesitter/nvim-treesitter) with [YAML support](https://github.com/ikatyang/tree-sitter-yaml)
2525+* [YAML support](https://github.com/ikatyang/tree-sitter-yaml) in [`treesitter`](https://neovim.viio/doc/user/treesitter.html)
26262727-Snacks, Telescope and fzf-lua are **optional**.
2727+[Snacks](https://github.com/folke/snacks.nvim), [Telescope](https://github.com/nvim-telescope/telescope.nvim) and [fzf-lua](https://github.com/ibhagwan/fzf-lua) are **optional**.
28282929<details>
3030···4444 "cuducos/yaml.nvim",
4545 ft = { "yaml" }, -- optional
4646 dependencies = {
4747- "nvim-treesitter/nvim-treesitter",
4847 "folke/snacks.nvim", -- optional
4948 "nvim-telescope/telescope.nvim", -- optional
5049 "ibhagwan/fzf-lua" -- optional
···5958 "cuducos/yaml.nvim",
6059 ft = { "yaml" }, -- optional
6160 requires = {
6262- "nvim-treesitter/nvim-treesitter",
6361 "folke/snacks.nvim", -- optional
6462 "nvim-telescope/telescope.nvim" -- optional
6563 "ibhagwan/fzf-lua" --optional
···7371Plug 'folke/snacks.nvim' " optional
7472Plug 'nvim-telescope/telescope.nvim' " optional
7573Plug 'ibhagwan/fzf-lua' " optional
7676-Plug 'nvim-treesitter/nvim-treesitter'
7774Plug 'cuducos/yaml.nvim'
7875```
79768077### No YAML parser?
81788282-If you get a <code>no parser for 'yaml' language</code> error message, this means that you need to install a parser such as [`tree-sitter-yaml`](https://github.com/ikatyang/tree-sitter-yaml). If that is the case, you need to enable it in your config.
7979+If you get a <code>no parser for 'yaml' language</code> error message, this means that you need to install a parser such as [`tree-sitter-yaml`](https://github.com/ikatyang/tree-sitter-yaml). From [Neovim's official `treesitter` docs](https://neovim.viio/doc/user/treesitter.html):
8080+8181+> You can install more parsers manually, or with a plugin like [`nvim-treesitter`](https://github.com/nvim-treesitter/nvim-treesitter)โ
83828483<details>
85848686-<summary>Here is an example, using <code>lazy.nvim</code></summary>
8585+<summary>Here is an example, using <code>lazy.nvim</code> and <code>nvim-treesitter</code> plugin</summary>
87868887```lua
8988{
-1
lua/yaml_nvim/document.lua
···11-local ts_utils = require("nvim-treesitter.ts_utils")
21local M = {}
3243local function get_keys(root)
+17-2
lua/yaml_nvim/pair.lua
···11-local ts_utils = require("nvim-treesitter.ts_utils")
21local M = {}
22+33+-- ported from nvim-treestter master branch (to be deprecated)
44+-- https://github.com/nvim-treesitter/nvim-treesitter/blob/42fc28ba918343ebfd5565147a42a26580579482/lua/nvim-treesitter/ts_utils.lua#L72-L90
55+function is_parent(dest, source)
66+ if not (dest and source) then
77+ return false
88+ end
99+ local current = source
1010+ while current ~= nil do
1111+ if current == dest then
1212+ return true
1313+ end
1414+ current = current:parent()
1515+ end
1616+ return false
1717+end
318419local function trim(value)
520 return (value:gsub("^%s*(.-)%s*$", "%1"))
···6580 for block_sequence, _ in block:iter_children() do
6681 local index = 0
6782 for block_sequence_item, _ in block_sequence:iter_children() do
6868- if ts_utils.is_parent(block_sequence_item, key) then
8383+ if is_parent(block_sequence_item, key) then
6984 return index
7085 end
7186 index = index + 1