YAML indenting with neovim and treesitter?

Viewed 839

I've recently upgraded to neovim 0.5.0, and I've been experimenting at replacing older syntax and indenting plugins with treesitter. I'm having some problems getting things to work correctly when editing YAML files.

I have the following in my init.lua file:

local ts = require 'nvim-treesitter.configs'
ts.setup {ensure_installed = 'maintained',
    highlight = {
        enable = true,
        additional_vim_regex_highlighting = false,
    },
    indent = {
        enable = true,
        disable = {"python", }
    },
}

Running :checkhealth reports

health#nvim_treesitter#check
========================================================================
[...]
## Parser/Features H L F I J
[...]
  - yaml           ✓ ✓ ✓ ✓ ✓ 

But when I create a YAML file, for example...

- hosts: foo<RETURN>

...then the cursor ends up at column 0 on the following line, rather than indented as required. This behaviors persists for the rest of the file: regardless of the YAML syntax, the cursor always goes to column 0 on return

I know that treesitter indent support is considered "experimental". Is this just broken right now, or do I have something misconfigured?

1 Answers
Related