I'm looking for a way to turn off automatic indentation in emacs. I don't want emacs to automatically indent code when I enter special characters like ; or /*
Thanks for any help.
Steve Yegge's js2-mode is great.
From http://code.google.com/p/js2-mode/
An improved JavaScript mode for GNU Emacs.
Features:
Eventually aims to be competitive with IntelliJ and other best-of-class JavaScript editors.
Note - this mode is for GNU Emacs, version 21 and higher. It does not support XEmacs.
If you're using an old mode based on CC-mode, Cc Cl
will toggle electricity.
There's a new Javascript mode that ships with Emacs that can be interactively toggled with Mx electric-indent-mode
Apparently, the new blessed way to achieve this is:
M-x electric-indent-mode
This command toggles "electric indentation", ie auto-indenting whenever certain special characters are hit.
The best thing is that it works accross major modes, not only for js-mode
(the default javascript major mode in recent version of Emacs).
Set javascript-auto-indent-flag
to nil
before loading javascript-mode. You can either add a line to your .emacs
file or type
M-x customize-group RET javascript RET
and edit the value there and save. You may need to restart Emacs for this to take effect; at least in the version of javascript.el
that I have, the flag is only consulted when setting up the keymap.
这将关闭所有缩进: Mx基本模式
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.