5

I'm editing React .jsx files, and I don't want to indent on newline, how to disable it?

Salah Eddine Taouririt
  • 24,925
  • 20
  • 60
  • 96

2 Answers2

9

M-x electric-indent-local-mode should do it if you're using Emacs-24.4.

Stefan
  • 27,908
  • 4
  • 53
  • 82
  • 1
    Is there a way to automatically set this for all js2 buffers, but leave all other buffers alone? – Roger Binns Jul 17 '15 at 01:05
  • 2
    The answer I gave only works on the current buffer. So you can add it to your `js2-mode-hook`, as in: `(add-hook 'js2-mode-hook (lambda () (electric-indent-local-mode -1)))` – Stefan Jul 19 '15 at 23:30
0

What seems to work in Emacs 25.1.1 is setting electric-layout-mode to -1. So In js2-mode-hook add:

(add-hook 'js2-mode-hook (lambda () (electric-layout-mode -1)))

chief
  • 1