mirror of
https://github.com/doomemacs/doomemacs
synced 2025-09-18 16:06:56 -05:00
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:
@@ -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
|
||||
|
Reference in New Issue
Block a user