feature/evil: normal state before window switching (to prevent state bleed)
This commit is contained in:
parent
90b4e22008
commit
004290b373
1 changed files with 9 additions and 0 deletions
|
@ -95,6 +95,15 @@
|
||||||
(evil-ex-nohighlight)))
|
(evil-ex-nohighlight)))
|
||||||
(advice-add #'evil-force-normal-state :after #'+evil*esc)
|
(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)
|
(defun +evil*static-reindent (orig-fn &rest args)
|
||||||
"Don't move cursor on indent."
|
"Don't move cursor on indent."
|
||||||
(save-excursion (apply orig-fn args)))
|
(save-excursion (apply orig-fn args)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue