How to handle LSPs producing undesirable indentations?

I am coding in R in nvim and having some difficulty with the way the indentations are turning out.

I have my indentation configured as:




And when I do =G, I get the following result (image), which is too many indents. Is this my R LSP messing things up, or do I not understand tabstop, shiftwidth and expandtab actually do?

How can I make it so that I don’t 8 indents when I only want two. What am I doing wrong?

The output of :verbose set shiftwidth is


Last set from Lua


:verbose set indentexpr?


 Last set from /usr/share/nvim/runtime/indent/r.vim line 15

and :verbose set equalprg?



I think I have an idea of where my issues are. And there is a good chance I am wrong about this being the Nvim/vim R-LSP. The LSP itself is here : GitHub - REditorSupport/languageserver: An implementation of the Language Server Protocol for R.

  1. Would hacking the lsp config cause issues down the line? With something like updates from the upstream?

If yes,

  1. Can I use something else to make the indents uniform? Whenever I copy paste something from other places, nvim just prints them out of whack. If = is not the answer then I am happy to use something else.