diff --git a/README.md b/README.md index 2605fa3..61151ac 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ using mnemonic key bindings. - [Package manager](#package-manager) - [Manually](#manually) - [Principle](#principle) - - [Commands and key bindings](#commands-and-key-bindings) + - [Commands and key bindings](#key-bindings) - [Configuration](#configuration) @@ -107,6 +107,7 @@ Key Binding | Function \ w | wrap expression with parenthesis \ W | unwrap expression \ y | copy expression +\ = | re-indent expression ## Configuration diff --git a/evil-lisp-state.el b/evil-lisp-state.el index 5c4b85a..df3b065 100644 --- a/evil-lisp-state.el +++ b/evil-lisp-state.el @@ -254,7 +254,8 @@ If `evil-lisp-state-global' is non nil then this variable has no effect." ("C-v" . evil-visual-block) ("w" . lisp-state-wrap) ("W" . sp-unwrap-sexp) - ("y" . sp-copy-sexp)) + ("y" . sp-copy-sexp) + ("=" . lisp-state-reindent)) "alist of keys and commands in lisp state.") (defvar evil-lisp-state-major-mode-map (make-sparse-keymap)) @@ -347,6 +348,13 @@ If `evil-lisp-state-global' is non nil then this variable has no effect." (sp-beginning-of-sexp) (evil-backward-char)) +(defun lisp-state-reindent () + "Re-indent everything within parent sexp" + (interactive) + (save-excursion + (backward-up-list 2 t) + (let ((bounds (bounds-of-thing-at-point 'sexp))) + (evil-indent (car bounds) (cdr bounds))))) (provide 'evil-lisp-state)