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


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))
  • 2
    for plain emacs just (setq-default typescript-indent-level 2) inside .emacs working Dec 23 '18 at 22:21

You can initialize this configuration with the layer.

In your ~/.spacemacs file, you can set your layers like this..

     (typescript :variables
                 typescript-indent-level 2

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.