4

I have a tsfmt.json file with

{
  "indentSize": 2,
  "tabSize": 2
}

which does get picked up appropriately by tide when running M-x tide-format.

But when I start a new line by pressing RET or 'o', it gets indented 4 spaces. How do I change this?


Using Spacemacs v.0.200.10 on GNU Emacs 27.0.50 (build 1, x86_64-apple-darwin16.7.0, NS appkit-1504.83 Version 10.12.6 (Build 16G29)) of 2017-09-17


Repro: asciicast

7

There is a variable called typescript-indent-level that, by default is set to 4. For Spacemacs specifically, you can change the value of this variable by directly setting it in your dotspacemacs/user-config function like so:

(defun dotspacemacs/user-config ()
  (setq-default typescript-indent-level 2))

As a Spacemacs user myself I'm not fully aware of the standard Emacs ways of customizing variables, but there are other options as well such as M-x customize.

  • 1
    for plain emacs just (setq-default typescript-indent-level 2) inside .emacs working – Daneel Yaitskov Dec 23 '18 at 22:21

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.