mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-27 14:23:43 -05:00
feature/evil: normal state before window switching (to prevent state bleed)
This commit is contained in:
@@ -95,6 +95,15 @@
|
||||
(evil-ex-nohighlight)))
|
||||
(advice-add #'evil-force-normal-state :after #'+evil*esc)
|
||||
|
||||
(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))
|
||||
(evil-normal-state +1))
|
||||
(apply orig-fn args))
|
||||
(advice-add #'windmove-do-window-select :around #'+evil*restore-normal-state-on-windmove)
|
||||
|
||||
(defun +evil*static-reindent (orig-fn &rest args)
|
||||
"Don't move cursor on indent."
|
||||
(save-excursion (apply orig-fn args)))
|
||||
|
Reference in New Issue
Block a user