Leaving insert state now return to previous state instead of normal state

Handy to go back and forth between lisp and insert state.
This commit is contained in:
syl20bnr 2014-10-10 11:32:03 -04:00
parent 8201b19a94
commit 646c25e031
2 changed files with 5 additions and 7 deletions

View file

@ -847,10 +847,9 @@ Key Binding | Function
`ESC` | evil-normal-state
**Important Note:**
Pressing `fd` while in `lisp state` will return to `normal state`,
*but* pressing `fd` while in `insert state` will return to `lisp state`.
`ESC` will always return to `normal state`.
Pressing `fd` while in `insert state` will return to previous evil state.
This is handy to keep going back and forth between `lisp state` and
`insert state`.
#### Magit

View file

@ -18,9 +18,8 @@
(global-set-key key `(lambda () (interactive) (spacemacs/switch-to-normal-mode ',seq 'keyboard-quit)))
(define-key minibuffer-local-map key `(lambda () (interactive) (spacemacs/switch-to-normal-mode ',seq 'abort-recursive-edit)))
(define-key evil-insert-state-map key `(lambda () (interactive)
(if (eq major-mode 'emacs-lisp-mode)
(spacemacs/switch-to-normal-mode ',seq 'evil-lisp-state)
(spacemacs/switch-to-normal-mode ',seq 'evil-normal-state))))
(spacemacs/switch-to-normal-mode ',seq (intern
(format "evil-%s-state" evil-previous-state)))))
(define-key evil-visual-state-map key `(lambda () (interactive) (spacemacs/switch-to-normal-mode ',seq 'evil-exit-visual-state)))
(define-key evil-emacs-state-map key `(lambda () (interactive) (spacemacs/switch-to-normal-mode ',seq 'evil-normal-state)))
(define-key evil-motion-state-map key `(lambda () (interactive) (spacemacs/switch-to-normal-mode ',seq 'evil-normal-state))))