2

I am coding in Node.js, each time I want to write something that looks like this:

const product = Factory
  .model('App/Models/Product')
  .create()

I get this as an output:

const product = Factory
      .model('App/Models/Product')
      .create()

enter image description here

And I delete back the space before the last line, and then I press Enter to continue coding, the last line jumps right again as this screenshot shows:

enter image description here

Adding (setq-default indent-tabs-mode nil) in my ~/.emacs file does not help.

What settings should I add for my Emacs to avoid this?

  • Which mode are you using? Is it js-mode, js2-mode, or something else? – DoMiNeLa10 Mar 5 at 17:02
  • Yes, I am using js2-mode – Begueradj Mar 5 at 17:06
  • Indentation in js2-mode is controlled by js-mode, and it seems that I can't get it to not give special indentation to chained calls. Maybe someone reported a problem with this before to either js-mode or js2-mode maintainers. – DoMiNeLa10 Mar 5 at 17:11
  • Interesting feedback, thank you, I will investigate more about it – Begueradj Mar 5 at 17:24
  • try changing indent level in C-h v js-chain-indent – A_P Mar 5 at 19:55
0

It is simpler than i thought. I use the same solution I used here and it worked: How do I set up indentation to 2 spaces in web-mode

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.