Skip to content

pmarinov/clean-aindent-mode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 

Repository files navigation

README

clean-aindent-mode.el — Emacs extension for clean auto-indent and backspace unindent

Features

  • 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.

Installation

  1. Download clean-aindent-mode.el

    $ wget https://github.com/pmarinov/clean-aindent-mode/archive/master.zip
    $ unzip master.zip
  2. Copy clean-aindent-mode.el to your ~/.emacs.d directory

    $ cp clean-aindent-master/clean-aindent-mode.el ~/.emacs.d
  3. Add this to your init.el

    (require 'clean-aindent-mode)
  4. For convenience, activate RET for auto indent operation (the default is C-j)

    (define-key global-map (kbd "RET") 'newline-and-indent)

Configuration

To activate the simple indent mode, do one of the two:

  1. In your init.el

    (set 'clean-aindent-is-simple-indent t)
  2. Via M-x customize

Search for auto indent, toggle to on. Then Apply and Save.

Installation and configuration via MELPA

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)

License

clean-aindent-mode was written by Peter Marinov

C0, public domain. See LICENSE.txt

Changelog

2015-06-18, v1.5.0, pmarinov

  • Fix for a compiler warning by justbur

  • Extra comments in README

2014-06-14, v1.4.0, pmarinov

  • Implement as an advice to 'newline-and-indent'

2014-06-12, v1.3.0, pmarinov

  • 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

2014-05-27, v1.2.0, pmarinov

  • Changed: Move all function under the same namespace (function prefix)

2014-03-07, v1.1.0, pmarinov

  • Added: Simple auto indent mode. Configurable via M-x customize.

2013-08-31, v1.0.0, pmarinov

  • First implementation

About

Emacs extension for simple indent and unindent

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •