feature/evil: switch to initial state on change window
This used to change to normal mode, but now it respects the buffer's initial state.
This commit is contained in:
parent
eaeb495b18
commit
b9d8116734
2 changed files with 8 additions and 8 deletions
|
@ -205,12 +205,12 @@ evil-window-move-* (e.g. `evil-window-move-far-left')"
|
|||
(save-excursion (apply orig-fn args)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil*restore-normal-state-on-windmove (orig-fn &rest args)
|
||||
"If in anything but normal or motion mode when moving to another window,
|
||||
restore normal mode. This prevents insert state from bleeding into other modes
|
||||
across windows."
|
||||
(unless (memq evil-state '(normal motion emacs))
|
||||
(evil-normal-state +1))
|
||||
(defun +evil*restore-initial-state-on-windmove (orig-fn &rest args)
|
||||
"Revert buffer to its initial state when switching to another window. This
|
||||
prevents states from bleeding into other modes across windows."
|
||||
(let ((initial-state (evil-initial-state major-mode 'normal)))
|
||||
(unless (eq evil-state initial-state)
|
||||
(evil-change-state initial-state)))
|
||||
(apply orig-fn args))
|
||||
|
||||
;;;###autoload
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue