···46}
47```
4800000000000000000000000049### With [`packer.nvim`](https://github.com/wbthomason/packer.nvim):
5051```lua
···8586```lua
87vim.api.nvim_create_autocmd({ "BufEnter", "CursorMoved" }, {
88- pattern = { "*.yaml" },
89- callback = function()
90- vim.opt_local.winbar = require("yaml_nvim").get_yaml_key_and_value()
91- end,
92})
93```
9495- You can also call `get_yaml_key()` instead of `get_yaml_key_and_value()` to show only the YAML key.
9697#### Neovim's statusline (with [`lualine.nvim`](https://github.com/nvim-lualine/lualine.nvim))
9899```lua
100require("lualine").setup({
101- sections = {
102- lualine_x = { require("yaml_nvim").get_yaml_key_and_value },
103- -- etc
104- }
105})
106-107```
108109## Reporting bugs and contributing
···46}
47```
4849+<details>
50+<summary>If you get a <code>no parser for 'yaml' language</code> error message when calling <code>:YAMLTelescope</code></summary>
51+52+This means that you need to install a parser such as [<code>tree-sitter-yaml</code>](https://github.com/ikatyang/tree-sitter-yaml).
53+54+Then you need to enable it in your nvim config. Here is an example.
55+56+```lua
57+{
58+ "nvim-treesitter/nvim-treesitter",
59+ build = ":TSUpdate",
60+ config = function()
61+ require("nvim-treesitter.configs").setup({
62+ ensure_installed = { "yaml" },
63+ highlight = {
64+ enable = true,
65+ disable = {},
66+ },
67+ })
68+ end,
69+}
70+```
71+</details>
72+73### With [`packer.nvim`](https://github.com/wbthomason/packer.nvim):
7475```lua
···109110```lua
111vim.api.nvim_create_autocmd({ "BufEnter", "CursorMoved" }, {
112+ pattern = { "*.yaml" },
113+ callback = function()
114+ vim.opt_local.winbar = require("yaml_nvim").get_yaml_key_and_value()
115+ end,
116})
117```
118119+You can also call `get_yaml_key()` instead of `get_yaml_key_and_value()` to show only the YAML key.
120121#### Neovim's statusline (with [`lualine.nvim`](https://github.com/nvim-lualine/lualine.nvim))
122123```lua
124require("lualine").setup({
125+ sections = {
126+ lualine_x = { require("yaml_nvim").get_yaml_key_and_value },
127+ -- etc
128+ }
129})
0130```
131132## Reporting bugs and contributing