I have a vanilla Spacemacs setup, and in my .spacemacs file, the dotspacemacs/user-config definition I have added (setq js2-basic-offset 2) which should be sufficient to set the indent length as 2. I have also placed this before in my user-init with no luck as well.

I can verify this in my window using SPC h d v which it shows to be 2.

Yet, in my .js files it continues to indent 4 spaces. My spacemacs shows "Javascript" for the major mode in the modeline bar.

Any ideas on what I am doing wrong/how I can debug this?


Turns out I needed js-indent-level because I was in js-mode. Still unsure how I ended up in js-mode and not js2-mode.

  • 2
    Can you accept your own answer?
    – syl20bnr
    Dec 10 '16 at 20:34
  • Unfortunately, I don't see the option.. Feb 13 '17 at 23:16
  • @AdamThompson There is usually an interval that must elapse before you can accept your own question (this is to prevent abusing the SE format to 'juice' your points). You should be able to accept it now.
    – Benjamin R
    Jul 15 '19 at 19:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.