How can I set indentexpr in init.lua?

Hello, I have something similar happening to me here: `o` in c++ incorrectly indents when using `set indentexpr=nvim_treesitter#indent()` · Issue #3216 · nvim-treesitter/nvim-treesitter · GitHub

Where the indentation of cpp files is one too many. If I run set indentexpr?, I get the following:

indentexpr=nvim_treesitter#indent()

If I manually unset indentexpr using set indentexpr="", everything works correctly. The problem is, I can’t figure out how to do this in my init.lua config.

vim.opt.indentexpr="" doesn’t work, nor does trying to follow instructions to set this in an after directory. I also tried to make an auto command, but that didn’t work either:

vim.api.nvim_create_autocmd({"BufReadPost", {
  pattern = {"*"},
  callback = function()
    vim.opt.indentexpr = ""
  end
})

I just see nvim_treesitter#indent() every time.

Thanks!
Cory

Try vim.o.indentexpr = ""

Just tried this, but unfortunately didn’t work. Thanks for responding, though!

I swore I added this to the OP, but I should mention that I’m using this on a mac, if that makes a difference.

I’ve got the same problem with markdown. With treesitter indentation it doesn’t indent more than the first line in an indentation, or continue multiline list items, however if I remove it manually it does. I’m also not able to reset it in my init.lua file.