23

This is similar question as this How do I change indent in php-mode to 2 spaces in Emacs? but for javascript-mode, I've try the same

(setq c-basic-offset 2)

but it don't work.

1 Answer 1

39

Found this as well

(setq js-indent-level 2)
Sign up to request clarification or add additional context in comments.

4 Comments

such a bummer that there are different variables to control this for every mode...
Unless your workplace uses different indentation in different languages — then it becomes a feature rather than a bug :)
They could follow the same naming conventions though.
They could default to using tab-width (or c-basic-offset) unless explicitly overridden.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.