How to get 2 spaces for tab? [SOLVED!]

I'm new here, a neovim exile as I don't like the racism.

I've compiled emacs 31 and I'm using eglot, php-ts-mode and phpantom_lsp (also tried phpactor). I'm trying to get it to auto indent/reformat using two spaces, not tabs, not four spaces!

Things I've tried:

  • (setq-default tab-width 2)
  • (setq tab-width 2)
  • install editorconfig package, add an .editorconfig file in the project root. It's enabled, apparently but still getting 4 spaces.
  • I read that when eglot is in use it defers formatting to the lsp. So I tried configuring that, but still getting 4. I still get 4 after M-x eglot-shutdown too, so I don't think it's eglot ?

Any help appreciated!

4 points · 1 comments · view on lemmy.world

1 Comments

nettie@lemmy.world · 2 pts · 11d

Ah ha, thanks to @vanni@mibl.vannilla.org over on mastodon, it seems the answer is:

(setopt php-ts-indent-offset 2)