clean-aindent-mode.el — Emacs extension for clean auto-indent and backspace unindent
-
An auto-indent function (RET) that takes care to delete any unused white spaces
-
An unindent function (M-backspace) that aligns the cursor position to match indentation of best candidate from lines above
-
Simple auto-indent mode (activate via M-x customize) that disregards smart language based indentation and instead consistently aligns only based on indentation of the line above
For detailed documentation with screenshots please visit the emacswiki page.
-
Download clean-aindent-mode.el
$ wget https://github.com/pmarinov/clean-aindent-mode/archive/master.zip $ unzip master.zip
-
Copy clean-aindent-mode.el to your ~/.emacs.d directory
$ cp clean-aindent-master/clean-aindent-mode.el ~/.emacs.d
-
Add this to your init.el
(require 'clean-aindent-mode)
-
For convenience, activate RET for auto indent operation (the default is C-j)
(define-key global-map (kbd "RET") 'newline-and-indent)
To activate the simple indent mode, do one of the two:
-
In your init.el
(set 'clean-aindent-is-simple-indent t)
-
Via M-x customize
Search for auto indent, toggle to on. Then Apply and Save.
An example configiration if the extension is installed via MELPA
(defun my-pkg-init() (electric-indent-mode -1) ; no electric indent, auto-indent is sufficient (clean-aindent-mode t) (setq clean-aindent-is-simple-indent t) (define-key global-map (kbd "RET") 'newline-and-indent)) (add-hook 'after-init-hook 'my-pkg-init)
clean-aindent-mode was written by Peter Marinov
C0, public domain. See LICENSE.txt
-
Changed: Change name space to be "clean-aindent--"
-
Changed: Implement a clean-aindent-mode as a way to turn on/off
-
Bugfix: Backspace unindent now handles TABs ('\t') correctly